feat: #chatgpt必应禁用搜索 #chatgpt必应开启搜索

This commit is contained in:
ikechan8370 2023-12-28 13:03:57 +08:00
parent fc4eaf8dcf
commit a00956ef43
4 changed files with 44 additions and 26 deletions

View file

@ -327,8 +327,8 @@ export class ChatgptManagement extends plugin {
permission: 'master' permission: 'master'
}, },
{ {
reg: '^#chatgpt修补Gemini$', reg: '^#chatgpt必应(禁用|禁止|关闭|启用|开启)搜索$',
fnc: 'patchGemini', fnc: 'switchBingSearch',
permission: 'master' permission: 'master'
} }
] ]
@ -1672,6 +1672,16 @@ azure语音Azure 语音是微软 Azure 平台提供的一项语音服务,
return false 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) { async saveXinghuoModel (e) {
if (!this.e.msg) return if (!this.e.msg) return
let token = this.e.msg let token = this.e.msg

View file

@ -374,6 +374,12 @@ export function supportGuoba () {
] ]
} }
}, },
{
field: 'sydneyEnableSearch',
label: '是否允许必应进行搜索',
bottomHelpMessage: '关闭后必应将禁用搜索',
component: 'Switch'
},
{ {
field: 'enableSuggestedResponses', field: 'enableSuggestedResponses',
label: '是否开启建议回复', label: '是否开启建议回复',

View file

@ -101,12 +101,12 @@ export default class SydneyAIClient {
this.opts.host = 'https://edgeservices.bing.com/edgesvc' this.opts.host = 'https://edgeservices.bing.com/edgesvc'
} }
logger.mark('使用host' + this.opts.host) 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 text = await response.text()
let retry = 10 let retry = 10
while (retry >= 0 && response.status === 200 && !text) { while (retry >= 0 && response.status === 200 && !text) {
await delay(400) 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() text = await response.text()
retry-- retry--
} }
@ -362,7 +362,7 @@ export default class SydneyAIClient {
// 'dagslnv1', // 'dagslnv1',
// 'sportsansgnd', // 'sportsansgnd',
// 'dl_edge_desc', // 'dl_edge_desc',
'noknowimg', // 'noknowimg',
// 'dtappid', // 'dtappid',
// 'cricinfo', // 'cricinfo',
// 'cricinfov2', // 'cricinfov2',
@ -370,21 +370,21 @@ export default class SydneyAIClient {
// 'gencontentv3', // 'gencontentv3',
'iycapbing', 'iycapbing',
'iyxapbing', 'iyxapbing',
'revimglnk', // 'revimglnk',
'revimgsrc1', // 'revimgsrc1',
'revimgur', // 'revimgur',
'clgalileo',
'eredirecturl' 'eredirecturl'
] ]
if (Config.enableGenerateContents) { if (Config.enableGenerateContents) {
optionsSets.push(...['gencontentv3']) optionsSets.push(...['gencontentv3'])
} }
if (!Config.sydneyEnableSearch || toSummaryFileContent?.content) {
optionsSets.push(...['nosearchall'])
}
let maxConv = Config.maxNumUserMessagesInConversation let maxConv = Config.maxNumUserMessagesInConversation
const currentDate = moment().format('YYYY-MM-DDTHH:mm:ssZ') const currentDate = moment().format('YYYY-MM-DDTHH:mm:ssZ')
const imageDate = await this.kblobImage(opts.imageUrl) const imageDate = await this.kblobImage(opts.imageUrl)
if (toSummaryFileContent?.content) {
// message = `请不要进行搜索,用户的问题是:"${message}"`
messageType = 'Chat'
}
let argument0 = { let argument0 = {
source: 'cib', source: 'cib',
optionsSets, optionsSets,
@ -392,17 +392,17 @@ export default class SydneyAIClient {
// 'InternalSearchQuery', 'InternalSearchResult', 'Disengaged', 'InternalLoaderMessage', 'Progress', 'RenderCardRequest', 'AdsQuery', // 'InternalSearchQuery', 'InternalSearchResult', 'Disengaged', 'InternalLoaderMessage', 'Progress', 'RenderCardRequest', 'AdsQuery',
'InvokeAction', 'SemanticSerp', 'GenerateContentQuery', 'SearchQuery'], 'InvokeAction', 'SemanticSerp', 'GenerateContentQuery', 'SearchQuery'],
sliceIds: [ sliceIds: [
'e2eperf', // 'e2eperf',
'gbacf', // 'gbacf',
'srchqryfix', // 'srchqryfix',
'caccnctacf', // 'caccnctacf',
'translref', // 'translref',
'fluxnosearchc', // 'fluxnosearchc',
'fluxnosearch', // 'fluxnosearch',
'1115rai289s0', // '1115rai289s0',
'1130deucs0', // '1130deucs0',
'1116pythons0', // '1116pythons0',
'cacmuidarb' // 'cacmuidarb'
], ],
requestId: crypto.randomUUID(), requestId: crypto.randomUUID(),
traceId: genRanHex(32), traceId: genRanHex(32),
@ -476,9 +476,9 @@ export default class SydneyAIClient {
conversationId, conversationId,
previousMessages, previousMessages,
plugins: [ plugins: [
{ // {
id: 'c310c353-b9f0-4d76-ab0d-1dd5e979cf68' // id: 'c310c353-b9f0-4d76-ab0d-1dd5e979cf68'
} // }
] ]
} }
if (encryptedconversationsignature) { if (encryptedconversationsignature) {
@ -799,6 +799,7 @@ export default class SydneyAIClient {
message, message,
conversationExpiryTime: event?.item?.conversationExpiryTime conversationExpiryTime: event?.item?.conversationExpiryTime
}) })
break
} }
default: default:
} }

View file

@ -42,6 +42,7 @@ const defaultConfig = {
sydneyImageRecognition: false, 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.', 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, enableSuggestedResponses: false,
sydneyEnableSearch: false,
api: defaultChatGPTAPI, api: defaultChatGPTAPI,
apiBaseUrl: 'https://chat3.avocado.wiki/backend-api', apiBaseUrl: 'https://chat3.avocado.wiki/backend-api',
apiForceUseReverse: false, apiForceUseReverse: false,