mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
为图片添加外部页面保存 (#167)
* 修复引用转发,默认bing模式并发 * 开启stream增加稳定性 * fix: remove queue element only in non-bing mode * 使用chatgpt-api自带的超时逻辑,文字过多时启动切换到图片输出防止被吞 * Update chat.js * 添加Bing专用的图片输出样式 * 添加chatgpt的新图片模式,临时处理切换api导致的对话异常 * 修改bing样式表 * 为图片添加外部页面缓存 * 为图片模式添加MathJax * feat: add switch for qrcode --------- Co-authored-by: ikechan8370 <geyinchibuaa@gmail.com>
This commit is contained in:
parent
de4a6c8f41
commit
a4f12eaf09
8 changed files with 132 additions and 7 deletions
46
apps/chat.js
46
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue