diff --git a/apps/management.js b/apps/management.js index ff74a30..64c30ee 100644 --- a/apps/management.js +++ b/apps/management.js @@ -327,8 +327,8 @@ export class ChatgptManagement extends plugin { permission: 'master' }, { - reg: '^#chatgpt修补Gemini$', - fnc: 'patchGemini', + reg: '^#chatgpt必应(禁用|禁止|关闭|启用|开启)搜索$', + fnc: 'switchBingSearch', permission: 'master' } ] @@ -1672,6 +1672,16 @@ azure语音:Azure 语音是微软 Azure 平台提供的一项语音服务, return false } + async switchBingSearch (e) { + if (e.msg.includes('启用') || e.msg.includes('开启')) { + Config.sydneyEnableSearch = true + await e.reply('已开启必应搜索') + } else { + Config.sydneyEnableSearch = false + await e.reply('已禁用必应搜索') + } + } + async saveXinghuoModel (e) { if (!this.e.msg) return let token = this.e.msg diff --git a/guoba.support.js b/guoba.support.js index c5c0c30..23ee28e 100644 --- a/guoba.support.js +++ b/guoba.support.js @@ -374,6 +374,12 @@ export function supportGuoba () { ] } }, + { + field: 'sydneyEnableSearch', + label: '是否允许必应进行搜索', + bottomHelpMessage: '关闭后必应将禁用搜索', + component: 'Switch' + }, { field: 'enableSuggestedResponses', label: '是否开启建议回复', diff --git a/utils/SydneyAIClient.js b/utils/SydneyAIClient.js index acf692b..f452bb5 100644 --- a/utils/SydneyAIClient.js +++ b/utils/SydneyAIClient.js @@ -101,12 +101,12 @@ export default class SydneyAIClient { this.opts.host = 'https://edgeservices.bing.com/edgesvc' } logger.mark('使用host:' + this.opts.host) - let response = await fetch(`${this.opts.host}/turing/conversation/create?bundleVersion=1.1366.5`, fetchOptions) + let response = await fetch(`${this.opts.host}/turing/conversation/create?bundleVersion=1.1381.12`, fetchOptions) let text = await response.text() let retry = 10 while (retry >= 0 && response.status === 200 && !text) { await delay(400) - response = await fetch(`${this.opts.host}/turing/conversation/create?bundleVersion=1.1366.5`, fetchOptions) + response = await fetch(`${this.opts.host}/turing/conversation/create?bundleVersion=1.1381.12`, fetchOptions) text = await response.text() retry-- } @@ -362,7 +362,7 @@ export default class SydneyAIClient { // 'dagslnv1', // 'sportsansgnd', // 'dl_edge_desc', - 'noknowimg', + // 'noknowimg', // 'dtappid', // 'cricinfo', // 'cricinfov2', @@ -370,21 +370,21 @@ export default class SydneyAIClient { // 'gencontentv3', 'iycapbing', 'iyxapbing', - 'revimglnk', - 'revimgsrc1', - 'revimgur', + // 'revimglnk', + // 'revimgsrc1', + // 'revimgur', + 'clgalileo', 'eredirecturl' ] if (Config.enableGenerateContents) { optionsSets.push(...['gencontentv3']) } + if (!Config.sydneyEnableSearch || toSummaryFileContent?.content) { + optionsSets.push(...['nosearchall']) + } let maxConv = Config.maxNumUserMessagesInConversation const currentDate = moment().format('YYYY-MM-DDTHH:mm:ssZ') const imageDate = await this.kblobImage(opts.imageUrl) - if (toSummaryFileContent?.content) { - // message = `请不要进行搜索,用户的问题是:"${message}"` - messageType = 'Chat' - } let argument0 = { source: 'cib', optionsSets, @@ -392,17 +392,17 @@ export default class SydneyAIClient { // 'InternalSearchQuery', 'InternalSearchResult', 'Disengaged', 'InternalLoaderMessage', 'Progress', 'RenderCardRequest', 'AdsQuery', 'InvokeAction', 'SemanticSerp', 'GenerateContentQuery', 'SearchQuery'], sliceIds: [ - 'e2eperf', - 'gbacf', - 'srchqryfix', - 'caccnctacf', - 'translref', - 'fluxnosearchc', - 'fluxnosearch', - '1115rai289s0', - '1130deucs0', - '1116pythons0', - 'cacmuidarb' + // 'e2eperf', + // 'gbacf', + // 'srchqryfix', + // 'caccnctacf', + // 'translref', + // 'fluxnosearchc', + // 'fluxnosearch', + // '1115rai289s0', + // '1130deucs0', + // '1116pythons0', + // 'cacmuidarb' ], requestId: crypto.randomUUID(), traceId: genRanHex(32), @@ -476,9 +476,9 @@ export default class SydneyAIClient { conversationId, previousMessages, plugins: [ - { - id: 'c310c353-b9f0-4d76-ab0d-1dd5e979cf68' - } + // { + // id: 'c310c353-b9f0-4d76-ab0d-1dd5e979cf68' + // } ] } if (encryptedconversationsignature) { @@ -799,6 +799,7 @@ export default class SydneyAIClient { message, conversationExpiryTime: event?.item?.conversationExpiryTime }) + break } default: } diff --git a/utils/config.js b/utils/config.js index 2ce7dd4..ff50aa0 100644 --- a/utils/config.js +++ b/utils/config.js @@ -42,6 +42,7 @@ const defaultConfig = { sydneyImageRecognition: false, sydneyMoodTip: 'Your response should be divided into two parts, namely, the text and your mood. The mood available to you can only include: blandness, happy, shy, frustrated, disgusted, and frightened.All content should be replied in this format {"text": "", "mood": ""}.All content except mood should be placed in text, It is important to ensure that the content you reply to can be parsed by json.', enableSuggestedResponses: false, + sydneyEnableSearch: false, api: defaultChatGPTAPI, apiBaseUrl: 'https://chat3.avocado.wiki/backend-api', apiForceUseReverse: false,