新渲染模式配置完善和bug修复 (#318)

This commit is contained in:
HalcyonAlcedo 2023-04-07 10:24:31 +08:00 committed by GitHub
parent f688b01816
commit 0a0cefe39c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 264 additions and 121 deletions

View file

@ -873,7 +873,7 @@ export class chatgpt extends plugin {
await this.reply(`出现错误:${err}`, true, { recallMsg: e.isGroup ? 10 : 0 })
} else {
// 这里是否还需要上传到缓存服务器呐?多半是代理服务器的问题,本地也修不了,应该不用吧。
await this.renderImage(e, use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', `通信异常,错误信息如下 ${err}`, prompt)
await this.renderImage(e, use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', `通信异常,错误信息如下 ${err.message}`, prompt)
}
}
}
@ -981,19 +981,19 @@ export class chatgpt extends plugin {
entry: cacheData.file,
userImg: `https://q1.qlogo.cn/g?b=qq&s=0&nk=${e.sender.user_id}`,
botImg: `https://q1.qlogo.cn/g?b=qq&s=0&nk=${Bot.uin}`,
QR: Config.showQRCode
cacheHost: Config.serverHost
})
}
const cacheres = await fetch(`http://127.0.0.1:${Config.serverPort || 3321}/cache`, cacheresOption)
const viewHost = Config.viewHost ? `${Config.viewHost}/` : `http://127.0.0.1:${Config.serverPort || 3321}/`
const cacheres = await fetch(viewHost + 'cache', cacheresOption)
if (cacheres.ok) {
cacheData = Object.assign({}, cacheData, await cacheres.json())
}
if (cacheData.error)
await this.reply(`出现错误:${cacheData.error}`, true)
else
await e.reply(await renderUrl(e, `http://127.0.0.1:${Config.serverPort || 3321}/page/${cacheData.file}`, { retType: Config.quoteReply ? 'base64' : '' }), e.isGroup && Config.quoteReply)
await e.reply(await renderUrl(e, viewHost + `page/${cacheData.file}?qr=${Config.showQRCode ? 'true' : 'false'}`, { retType: Config.quoteReply ? 'base64' : '', Viewport: {width: Config.chatViewWidth, height: parseInt(Config.chatViewWidth * 0.56)} }), e.isGroup && Config.quoteReply)
} else {
if (Config.cacheEntry) cacheData.file = randomString()
const cacheresOption = {
method: 'POST',

View file

@ -303,7 +303,7 @@ export class help extends plugin {
}
async newHelp (e) {
let use = e.msg.replace(/^#帮助-/, '')
let use = e.msg.replace(/^#帮助-/, '').toUpperCase()
await renderUrl(e, `http://127.0.0.1:${Config.serverPort || 3321}/help/` + use, {Viewport: {width: 800, height: 600}})
}