diff --git a/.gitignore b/.gitignore index 5260dca..0ad42c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ config/* !config/config.example.js -node_modules/ \ No newline at end of file +node_modules/ diff --git a/apps/chat.js b/apps/chat.js index 9fb65a4..ef0b2ca 100644 --- a/apps/chat.js +++ b/apps/chat.js @@ -288,7 +288,7 @@ export class chatgpt extends plugin { // 队列队尾插入,开始排队 await redis.rPush('CHATGPT:CHAT_QUEUE', [randomId]) let confirm = await redis.get('CHATGPT:CONFIRM') - let confirmOn = !confirm || confirm === 'on' + let confirmOn = (!confirm || confirm === 'on') && Config.thinkingTips if (await redis.lIndex('CHATGPT:CHAT_QUEUE', 0) === randomId) { if (confirmOn) { await this.reply('我正在思考如何回复你,请稍等', true, { recallMsg: 8 }) @@ -468,12 +468,12 @@ export class chatgpt extends plugin { } ) let cache = {file:'',cacheUrl:Config.cacheUrl} - if (cacheres.ok) - cache = await cacheres.json() - cache.cacheUrl = Config.cacheUrl + if (cacheres.ok) { + cache = Object.assign({}, cache, await cacheres.json()) + } await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: escapeHtml(response), prompt: escapeHtml(prompt), senderName: e.sender.nickname, cache: cache }) } else { - await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: escapeHtml(response), prompt: escapeHtml(prompt), senderName: e.sender.nickname }) + await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: escapeHtml(response), prompt: escapeHtml(prompt), senderName: e.sender.nickname, cache: {file:'',cacheUrl:Config.cacheUrl} }) } } else { let quotemessage = [] @@ -504,12 +504,12 @@ export class chatgpt extends plugin { } ) let cache = {file:'',cacheUrl:Config.cacheUrl} - if (cacheres.ok) - cache = await cacheres.json() - cache.cacheUrl = Config.cacheUrl + if (cacheres.ok) { + cache = Object.assign({}, cache, await cacheres.json()) + } await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: escapeHtml(response), prompt: escapeHtml(prompt), senderName: e.sender.nickname, quote: quotemessage.length > 0 , quotes: quotemessage, cache: cache }) } else { - await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: escapeHtml(response), prompt: escapeHtml(prompt), senderName: e.sender.nickname, quote: quotemessage.length > 0 , quotes: quotemessage }) + await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: escapeHtml(response), prompt: escapeHtml(prompt), senderName: e.sender.nickname, quote: quotemessage.length > 0 , quotes: quotemessage, cache: {file:'',cacheUrl:Config.cacheUrl} }) } } else { await this.reply(`${response}`, e.isGroup) diff --git a/config/config.example.js b/config/config.example.js index def12d6..e2aa313 100644 --- a/config/config.example.js +++ b/config/config.example.js @@ -57,6 +57,8 @@ export default { // promptPrefixOverride: 'Your answer shouldn\'t be too verbose. If you are generating a list, do not have too many items. Keep the number of items short. Prefer to answer in Chinese.', // AI认为的自己的名字,当你问他你是谁是他会回答这里的名字。 // assistantLabel: 'ChatGPT', + // 是否开启AI正在思考中的提示信息 + // thinkingTips: true, // *********************************************************************************************************************************** // 以下为浏览器方式的配置 * // *********************************************************************************************************************************** diff --git a/utils/config.js b/utils/config.js index 9d9abc8..0cda75e 100644 --- a/utils/config.js +++ b/utils/config.js @@ -16,6 +16,7 @@ const defaultConfig = { reverseProxy: 'https://chatgpt.pawan.krd/api/completions', promptPrefixOverride: 'Your answer shouldn\'t be too verbose. If you are generating a list, do not have too many items. Keep the number of items short. Prefer to answer in Chinese.', assistantLabel: 'ChatGPT', + thinkingTips: true, username: '', password: '', headless: false, @@ -30,11 +31,11 @@ const _path = process.cwd() let config = {} if (fs.existsSync(`${_path}/plugins/chatgpt-plugin/config/config.js`)) { const fullPath = fs.realpathSync(`${_path}/plugins/chatgpt-plugin/config/config.js`); - config = (await import(fullPath)).default; + config = (await import(`file://${fullPath}`)).default; } else if (fs.existsSync(`${_path}/plugins/chatgpt-plugin/config/index.js`)) { // 兼容旧版本 const fullPath = fs.realpathSync(`${_path}/plugins/chatgpt-plugin/config/index.js`); - config = (await import(fullPath)).Config; + config = (await import(`file://${fullPath}`)).Config; } export const Config = Object.assign({}, defaultConfig, config); \ No newline at end of file