修复bug (#321)

This commit is contained in:
HalcyonAlcedo 2023-04-07 16:32:24 +08:00 committed by GitHub
parent 0a0cefe39c
commit 3b66f6d3f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 44 additions and 11 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.message}`, prompt)
await this.renderImage(e, use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', `通信异常,错误信息如下 ${err?.message || err?.data?.message || (typeof(err) === 'object' ? JSON.stringify(err) : err) || '未能确认错误类型!'}`, prompt)
}
}
}

View file

@ -531,6 +531,12 @@ export function supportGuoba () {
bottomHelpMessage: '聊天页面渲染窗口的宽度',
component: 'InputNumber',
},
{
field: 'chatViewBotName',
label: 'Bot命名',
bottomHelpMessage: '新渲染模式强制修改Bot命名',
component: 'Input'
},
],
// 获取配置数据方法(用于前端填充显示数据)
getConfigData () {

View file

@ -49,6 +49,7 @@ export async function createServer() {
const stream = fs.createReadStream('plugins/chatgpt-plugin/server/static/index.html')
reply.type('text/html').send(stream)
})
// 页面数据获取
server.post('/page', async (request, reply) => {
const body = request.body || {}
if (body.code) {
@ -60,6 +61,7 @@ export async function createServer() {
reply.send(data)
}
})
// 帮助内容获取
server.post('/help', async (request, reply) => {
const body = request.body || {}
if (body.use) {
@ -71,6 +73,7 @@ export async function createServer() {
reply.send(data[body.use])
}
})
// 创建页面缓存内容
server.post('/cache', async (request, reply) => {
const body = request.body || {}
if (body.content) {
@ -83,7 +86,7 @@ export async function createServer() {
fs.mkdirSync(dir, { recursive: true });
fs.writeFileSync(filepath, JSON.stringify({
user: body.content.senderName,
bot: (body.bing ? 'Bing' : 'ChatGPT'),
bot: Config.chatViewBotName || (body.bing ? 'Bing' : 'ChatGPT'),
userImg: body.userImg || '',
botImg: body.botImg || '',
question: body.content.prompt,

File diff suppressed because one or more lines are too long

View file

@ -17,4 +17,4 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-->
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="76x76" href="/apple-icon.png"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css"/><script src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js"></script><title>ChatGPT-Plugin</title><script defer="defer" src="/js/chunk-vendors.41e7b735.js"></script><script defer="defer" src="/js/app.6b32cca7.js"></script><link href="/css/chunk-vendors.016e0765.css" rel="stylesheet"><link href="/css/app.432d8899.css" rel="stylesheet"></head><body class="text-blueGray-700 antialiased"><noscript><strong>We're sorry but vue-notus doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="76x76" href="/apple-icon.png"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css"/><script src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.6.3/mermaid.min.js"></script><title>ChatGPT-Plugin</title><script defer="defer" src="/js/chunk-vendors.bc8c7ae8.js"></script><script defer="defer" src="/js/app.4195158e.js"></script><link href="/css/chunk-vendors.f10f650e.css" rel="stylesheet"><link href="/css/app.6561b27a.css" rel="stylesheet"></head><body class="text-blueGray-700 antialiased"><noscript><strong>We're sorry but vue-notus doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -84,6 +84,7 @@ const defaultConfig = {
serverHost: '',
viewHost: '',
chatViewWidth: 1280,
chatViewBotName: '',
version: 'v2.4.12'
}
const _path = process.cwd()