diff --git a/src/_locales/en/main.json b/src/_locales/en/main.json index c0d0b7a..b12b317 100644 --- a/src/_locales/en/main.json +++ b/src/_locales/en/main.json @@ -118,5 +118,8 @@ "Close All Chats In This Page": "Close All Chats In This Page", "When Icon Clicked": "When Icon Clicked", "Open Settings": "Open Settings", - "Focus to input box after answering": "Focus to input box after answering" + "Focus to input box after answering": "Focus to input box after answering", + "Bing CaptchaChallenge": "You must pass Bing's verification. Please go to https://www.bing.com/search?q=Bing+AI&showconv=1&FORM=hpcodx and send a message", + "Exceeded quota": "You exceeded your current quota, check https://platform.openai.com/account/usage", + "Rate limit": "Rate limit exceeded" } diff --git a/src/_locales/zh-hans/main.json b/src/_locales/zh-hans/main.json index 67d9282..47da85e 100644 --- a/src/_locales/zh-hans/main.json +++ b/src/_locales/zh-hans/main.json @@ -118,5 +118,8 @@ "Close All Chats In This Page": "关闭本页所有聊天", "When Icon Clicked": "当图标被点击时", "Open Settings": "打开设置", - "Focus to input box after answering": "回答结束后自动聚焦到输入框" + "Focus to input box after answering": "回答结束后自动聚焦到输入框", + "Bing CaptchaChallenge": "你必须通过必应的验证, 打开 https://www.bing.com/search?q=Bing+AI&showconv=1&FORM=hpcodx 并发送一条消息", + "Exceeded quota": "余额不足或过期, 检查此链接: https://platform.openai.com/account/usage", + "Rate limit": "请求频率过高" } diff --git a/src/_locales/zh-hant/main.json b/src/_locales/zh-hant/main.json index b164716..9ad9669 100644 --- a/src/_locales/zh-hant/main.json +++ b/src/_locales/zh-hant/main.json @@ -118,5 +118,8 @@ "Close All Chats In This Page": "關閉本頁所有對話", "When Icon Clicked": "當圖示被點擊時", "Open Settings": "開啟設定", - "Focus to input box after answering": "回答結束後自動聚焦到輸入框" + "Focus to input box after answering": "回答結束後自動聚焦到輸入框", + "Bing CaptchaChallenge": "妳必須通過必應的驗證, 打開 https://www.bing.com/search?q=Bing+AI&showconv=1&FORM=hpcodx 並發送壹條消息", + "Exceeded quota": "余額不足或過期, 檢查此網址: https://platform.openai.com/account/usage", + "Rate limit": "請求頻率過高" } diff --git a/src/services/clients/bing/index.mjs b/src/services/clients/bing/index.mjs index 23a73da..49c07a1 100644 --- a/src/services/clients/bing/index.mjs +++ b/src/services/clients/bing/index.mjs @@ -234,6 +234,7 @@ export default class BingAIClient { author: 'system', }, ...previousCachedMessages, + // We still need this to avoid repeating introduction in some cases { text: message, author: 'user', @@ -241,13 +242,6 @@ export default class BingAIClient { ] : undefined - if (context) { - previousMessages.push({ - text: context, - author: 'context', // not a real/valid author, we're just piggybacking on the existing logic - }) - } - // prepare messages for prompt injection previousMessagesFormatted = previousMessages ?.map((previousMessage) => { @@ -257,14 +251,16 @@ export default class BingAIClient { case 'bot': return `[assistant](#message)\n${previousMessage.text}` case 'system': - return `N/A\n\n[system](#additional_instructions)\n- ${previousMessage.text}` - case 'context': - return `[user](#context)\n${previousMessage.text}` + return `[system](#additional_instructions)\n${previousMessage.text}` default: throw new Error(`Unknown message author: ${previousMessage.author}`) } }) .join('\n\n') + + if (context) { + previousMessagesFormatted = `${context}\n\n${previousMessagesFormatted}` + } } const userMessage = { @@ -313,13 +309,14 @@ export default class BingAIClient { 'cricinfo', 'cricinfov2', 'dv3sugg', + 'nojbfedge', ], sliceIds: ['222dtappid', '225cricinfo', '224locals0'], traceId: genRanHex(32), isStartOfSession: invocationId === 0, message: { author: 'user', - text: jailbreakConversationId ? '' : message, + text: message, messageType: jailbreakConversationId ? 'SearchQuery' : 'Chat', }, conversationSignature, diff --git a/src/services/wrappers.mjs b/src/services/wrappers.mjs index 1228b19..07d16a1 100644 --- a/src/services/wrappers.mjs +++ b/src/services/wrappers.mjs @@ -55,7 +55,13 @@ export function registerPortListener(executor) { err.message.includes(m), ) ) - port.postMessage({ error: t('Exceeded maximum context length') + '\n' + err.message }) + port.postMessage({ error: t('Exceeded maximum context length') + '\n\n' + err.message }) + else if (['CaptchaChallenge', 'CAPTCHA'].some((m) => err.message.includes(m))) + port.postMessage({ error: t('Bing CaptchaChallenge') + '\n\n' + err.message }) + else if (['exceeded your current quota'].some((m) => err.message.includes(m))) + port.postMessage({ error: t('Exceeded quota') + '\n\n' + err.message }) + else if (['Rate limit reached'].some((m) => err.message.includes(m))) + port.postMessage({ error: t('Rate limit') + '\n\n' + err.message }) else port.postMessage({ error: err.message }) } }