diff --git a/apps/chat.js b/apps/chat.js index 7dc35da..5ae128b 100644 --- a/apps/chat.js +++ b/apps/chat.js @@ -442,7 +442,28 @@ export class chatgpt extends plugin { let converted = response // converter.makeHtml(response) /** 最后回复消息 */ - await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: converted, prompt, senderName: e.sender.nickname }) + if (Config.showQRCode) { + let cacheres = await fetch('http://content.alcedogroup.com/cache', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + content: { + content: converted, + prompt, + senderName: e.sender.nickname + // quote: quotemessage + }, + bing: use === 'bing' + }) + } + ) + let cache = await cacheres.json() + await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: converted, prompt, senderName: e.sender.nickname, cache: cache.file }) + } else { + await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: converted, prompt, senderName: e.sender.nickname }) + } } else { let quotemessage = [] if (chatMessage?.quote) { @@ -454,7 +475,28 @@ export class chatgpt extends plugin { } if (Config.autoUsePicture && response.length > Config.autoUsePictureThreshold) { // 文字过多时自动切换到图片模式输出 - await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: response, prompt, quote: quotemessage, senderName: e.sender.nickname }) + if (Config.showQRCode) { + let cacheres = await fetch('http://content.alcedogroup.com/cache', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + content: { + content: response, + prompt, + senderName: e.sender.nickname, + quote: quotemessage + }, + bing: use === 'bing' + }) + } + ) + let cache = await cacheres.json() + await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: converted, prompt, senderName: e.sender.nickname, cache: cache.file }) + } else { + await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: converted, prompt, senderName: e.sender.nickname }) + } } else { await this.reply(`${response}`, e.isGroup) if (quotemessage.length > 0) { diff --git a/config/index.js b/config/index.js index 7e8bebd..ee41b5c 100644 --- a/config/index.js +++ b/config/index.js @@ -18,6 +18,8 @@ export const Config = { conversationPreserveTime: 0, // 触发方式 可选值:at 或 prefix 。at模式下只有at机器人才会回复。prefix模式下不需要at,但需要添加前缀#chat toggleMode: 'at', + // 是否在图片模式中启用二维码。该对话内容将被发送至第三方服务器以进行渲染展示。改为false关闭该功能 + showQRCode: true, // *********************************************************************************************************************************** // 以下为API方式(默认)的配置 * // *********************************************************************************************************************************** diff --git a/resources/content/Bing/index.html b/resources/content/Bing/index.html index db1e82a..929b052 100644 --- a/resources/content/Bing/index.html +++ b/resources/content/Bing/index.html @@ -18,7 +18,7 @@
@@ -31,6 +31,9 @@

New Bing

+ {{if cache != ''}} +

{{cache}}

+ {{/if}}
@@ -56,6 +59,7 @@
+ {{if quote.length > 0}}
@@ -69,13 +73,19 @@
+ {{/if}} + {{if cache != ''}} +
+ {{/if}}