mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
新渲染模式配置完善和bug修复 (#318)
This commit is contained in:
parent
f688b01816
commit
0a0cefe39c
12 changed files with 264 additions and 121 deletions
10
apps/chat.js
10
apps/chat.js
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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}})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -513,6 +513,24 @@ export function supportGuoba () {
|
|||
bottomHelpMessage: '系统Api服务开启的端口号,如需外网访问请将系统防火墙和服务器防火墙对应端口开放,修改后请重启',
|
||||
component: 'InputNumber',
|
||||
},
|
||||
{
|
||||
field: 'serverHost',
|
||||
label: '系统服务访问域名',
|
||||
bottomHelpMessage: '使用域名代替公网ip,适用于有服务器和域名的朋友避免暴露ip使用',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
field: 'viewHost',
|
||||
label: '渲染服务器地址',
|
||||
bottomHelpMessage: '可选择第三方渲染服务器',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
field: 'chatViewWidth',
|
||||
label: '图片渲染宽度',
|
||||
bottomHelpMessage: '聊天页面渲染窗口的宽度',
|
||||
component: 'InputNumber',
|
||||
},
|
||||
],
|
||||
// 获取配置数据方法(用于前端填充显示数据)
|
||||
getConfigData () {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-comments",
|
||||
"icon": "fas fa-comment",
|
||||
"title": "ChatGPT切换对话",
|
||||
"text": "切换到指定对话当中<span class=\"text-xs font-semibold inline-block py-1 px-2 uppercase rounded text-blueGray-600 bg-blueGray-200\">仅API3可用</span>",
|
||||
"list": [
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-comments",
|
||||
"icon": "fas fa-comment",
|
||||
"title": "ChatGPT加入对话",
|
||||
"text": "加入到某人当前进行对话当中<span class=\"text-xs font-semibold inline-block py-1 px-2 uppercase rounded text-blueGray-600 bg-blueGray-200\">仅API3可用</span>",
|
||||
"list": [
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-comments",
|
||||
"icon": "fas fa-trash ",
|
||||
"title": "删除对话",
|
||||
"text": "删除指定对话,并清空与用户的关联信息。@用户时支持多个用户",
|
||||
"list": [
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-comments",
|
||||
"icon": "fas fa-outdent",
|
||||
"title": "结束对话",
|
||||
"text": "结束自己当前对话,下次开启对话机器人将遗忘掉本次对话内容",
|
||||
"list": [
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-comments",
|
||||
"icon": "fas fa-eraser",
|
||||
"title": "结束全部对话",
|
||||
"text": "结束正在与本机器人进行对话的全部用户的对话",
|
||||
"list": [
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-comments",
|
||||
"icon": "fas fa-book",
|
||||
"title": "聊天记录",
|
||||
"text": "图片形式导出聊天记录<span class=\"text-xs font-semibold inline-block py-1 px-2 uppercase rounded text-blueGray-600 bg-blueGray-200\">仅支持Bing下的Sydney和自定义</span>",
|
||||
"list": [
|
||||
|
|
@ -66,11 +66,29 @@
|
|||
"#chatgpt导出聊天记录"
|
||||
],
|
||||
"tip": "管理员功能"
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-cube",
|
||||
"title": "聊天回复模式",
|
||||
"text": "设置机器人以图片模式、文本模式或语音模式回复",
|
||||
"list": [
|
||||
"#chatgpt图片模式",
|
||||
"#chatgpt文本模式",
|
||||
"#chatgpt语音模式"
|
||||
]
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-headphones",
|
||||
"title": "语音角色",
|
||||
"text": "设置语音模式下回复的角色音色",
|
||||
"list": [
|
||||
"#chatgpt设置语音角色"
|
||||
]
|
||||
}
|
||||
],
|
||||
"AI画图": [
|
||||
{
|
||||
"icon": "fas fa-comments",
|
||||
"icon": "fas fa-paint-brush",
|
||||
"title": "画图",
|
||||
"text": "调用**OpenAI Dalle API**进行绘图,需要有**API key**并消耗余额。图片大小只能是<span class=\"text-xs font-semibold inline-block py-1 px-2 uppercase rounded text-blueGray-600 bg-blueGray-200\">256x256</span><span class=\"text-xs font-semibold inline-block py-1 px-2 uppercase rounded text-blueGray-600 bg-blueGray-200\">512x512</span><span class=\"text-xs font-semibold inline-block py-1 px-2 uppercase rounded text-blueGray-600 bg-blueGray-200\">1024x1024</span>中的一个,默认画图**1**张,大小<span class=\"text-xs font-semibold inline-block py-1 px-2 uppercase rounded text-blueGray-600 bg-blueGray-200\">512x512</span>",
|
||||
"list": [
|
||||
|
|
@ -79,7 +97,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-comments",
|
||||
"icon": "fas fa-paint-brush",
|
||||
"title": "改图",
|
||||
"text": "调用**OpenAI Dalle API**进行绘图,需要有**API key**并消耗余额。可同时发送图片或回复图片",
|
||||
"list": [
|
||||
|
|
@ -87,21 +105,130 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-comments",
|
||||
"icon": "fas fa-toggle-on",
|
||||
"title": "画图开关",
|
||||
"text": "开启或关闭画图功能",
|
||||
"list": [
|
||||
"#结束全部对话"
|
||||
"#chatgpt开启画图",
|
||||
"#chatgpt关闭画图"
|
||||
],
|
||||
"tip": "管理员功能"
|
||||
}
|
||||
],
|
||||
"插件管理": [
|
||||
{
|
||||
"icon": "fas fa-list",
|
||||
"title": "对话列表",
|
||||
"text": "查询当前哪些人正在与机器人聊天.目前<span class=\"text-xs font-semibold inline-block py-1 px-2 uppercase rounded text-blueGray-600 bg-blueGray-200\">API3模式</span>下支持切换对话",
|
||||
"list": [
|
||||
"#chatgpt对话列表"
|
||||
],
|
||||
"tip": "管理员功能"
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-microphone-slash",
|
||||
"title": "闭嘴",
|
||||
"text": "让机器人在某群闭嘴,不指定群时认为全局闭嘴",
|
||||
"list": [
|
||||
"#chatgpt本群闭嘴",
|
||||
"#chatgpt群xxx闭嘴",
|
||||
"#chatgpt闭嘴(x秒/分钟/小时)",
|
||||
"#chatgpt本群张嘴",
|
||||
"#chatgpt本群开口",
|
||||
"#chatgpt群xxx说话",
|
||||
"#chatgpt上班",
|
||||
"#chatgpt查看闭嘴"
|
||||
],
|
||||
"tip": "管理员功能"
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-list",
|
||||
"title": "Chat队列",
|
||||
"text": "移出或清空当前对话等待队列,若前方对话卡死可使用本命令。仅<span class=\"text-xs font-semibold inline-block py-1 px-2 uppercase rounded text-blueGray-600 bg-blueGray-200\">API3模式</span>下可用",
|
||||
"list": [
|
||||
"#清空chat队列",
|
||||
"#移出chat队列首位"
|
||||
],
|
||||
"tip": "管理员功能"
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-check",
|
||||
"title": "问题确认",
|
||||
"text": "开启或关闭机器人收到消息后的确认回复消息",
|
||||
"list": [
|
||||
"#chatgpt开启问题确认",
|
||||
"#chatgpt关闭问题确认"
|
||||
],
|
||||
"tip": "管理员功能"
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-cube",
|
||||
"title": "切换模式",
|
||||
"text": "切换使用的后端会话模式",
|
||||
"list": [
|
||||
"#chatgpt切换浏览器",
|
||||
"#chatgpt切换API",
|
||||
"#chatgpt切换API3",
|
||||
"#chatgpt切换Bing",
|
||||
"#chatgpt切换ChatGLM"
|
||||
],
|
||||
"tip": "管理员功能"
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-coffee",
|
||||
"title": "必应风格",
|
||||
"text": "切换Bing风格",
|
||||
"list": [
|
||||
"#chatgpt必应切换精准",
|
||||
"#chatgpt必应切换均衡",
|
||||
"#chatgpt必应切换创意",
|
||||
"#chatgpt必应切换悉尼",
|
||||
"#chatgpt必应切换自设定"
|
||||
],
|
||||
"tip": "管理员功能"
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-comments",
|
||||
"title": "施工中",
|
||||
"text": "插件管理帮助仍在编写当中!",
|
||||
"list": []
|
||||
"title": "必应建议",
|
||||
"text": "开关Bing模式下的建议回复",
|
||||
"list": [
|
||||
"#chatgpt必应开启建议回复",
|
||||
"#chatgpt必应关闭建议回复"
|
||||
],
|
||||
"tip": "管理员功能"
|
||||
}
|
||||
],
|
||||
"系统设置": [
|
||||
{
|
||||
"icon": "fas fa-key",
|
||||
"title": "Token与APIKey",
|
||||
"text": "设置必应和open的Token和ApiKey",
|
||||
"list": [
|
||||
"#chatgpt设置必应token",
|
||||
"#chatgpt设置APIKey"
|
||||
],
|
||||
"tip": "管理员功能"
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-credit-card",
|
||||
"title": "试用额度",
|
||||
"text": "查询OpenAI API剩余试用额度",
|
||||
"list": [
|
||||
"#OpenAI剩余额度"
|
||||
],
|
||||
"tip": "管理员功能"
|
||||
},
|
||||
{
|
||||
"icon": "fas fa-coffee",
|
||||
"title": "风格",
|
||||
"text": "设置和查看AI的默认风格设定",
|
||||
"list": [
|
||||
"#chatgpt设置API设定",
|
||||
"#chatgpt设置Sydney设定",
|
||||
"#chatgpt查看API设定",
|
||||
"#chatgpt查看Sydney设定"
|
||||
],
|
||||
"tip": "管理员功能"
|
||||
}
|
||||
]
|
||||
}
|
||||
151
server/index.js
151
server/index.js
|
|
@ -29,91 +29,86 @@ function getPublicIP() {
|
|||
})
|
||||
}
|
||||
|
||||
export async function createServer() {
|
||||
const __dirname = path.resolve()
|
||||
const server = fastify({
|
||||
logger: Config.debug
|
||||
})
|
||||
|
||||
|
||||
await server.register(cors, {
|
||||
origin: '*',
|
||||
})
|
||||
await server.register(fstatic, {
|
||||
root: path.join(__dirname, 'plugins/chatgpt-plugin/server/static/'),
|
||||
})
|
||||
await server.get('/page/*', (request, reply) => {
|
||||
const stream = fs.createReadStream('plugins/chatgpt-plugin/server/static/index.html')
|
||||
reply.type('text/html').send(stream)
|
||||
})
|
||||
await server.get('/help/*', (request, reply) => {
|
||||
const stream = fs.createReadStream('plugins/chatgpt-plugin/server/static/index.html')
|
||||
reply.type('text/html').send(stream)
|
||||
})
|
||||
|
||||
server.post('/page', async (request, reply) => {
|
||||
export async function createServer() {
|
||||
await server.register(cors, {
|
||||
origin: '*',
|
||||
})
|
||||
await server.register(fstatic, {
|
||||
root: path.join(__dirname, 'plugins/chatgpt-plugin/server/static/'),
|
||||
})
|
||||
await server.get('/page/*', (request, reply) => {
|
||||
const stream = fs.createReadStream('plugins/chatgpt-plugin/server/static/index.html')
|
||||
reply.type('text/html').send(stream)
|
||||
})
|
||||
await server.get('/help/*', (request, reply) => {
|
||||
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) {
|
||||
const dir = 'resources/ChatGPTCache/page'
|
||||
const filename = body.code + '.json'
|
||||
const filepath = path.join(dir, filename)
|
||||
|
||||
let data = fs.readFileSync(filepath, 'utf8')
|
||||
reply.send(data)
|
||||
}
|
||||
})
|
||||
server.post('/help', async (request, reply) => {
|
||||
const body = request.body || {}
|
||||
if (body.code) {
|
||||
const dir = 'resources/ChatGPTCache/page'
|
||||
const filename = body.code + '.json'
|
||||
if (body.use) {
|
||||
const dir = 'plugins/chatgpt-plugin/resources'
|
||||
const filename = 'help.json'
|
||||
const filepath = path.join(dir, filename)
|
||||
|
||||
let data = fs.readFileSync(filepath, 'utf8')
|
||||
reply.send(data)
|
||||
data = JSON.parse(data)
|
||||
reply.send(data[body.use])
|
||||
}
|
||||
})
|
||||
|
||||
server.post('/help', async (request, reply) => {
|
||||
const body = request.body || {}
|
||||
if (body.use) {
|
||||
const dir = 'plugins/chatgpt-plugin/resources'
|
||||
const filename = 'help.json'
|
||||
const filepath = path.join(dir, filename)
|
||||
let data = fs.readFileSync(filepath, 'utf8')
|
||||
data = JSON.parse(data)
|
||||
reply.send(data[body.use])
|
||||
}
|
||||
})
|
||||
|
||||
server.post('/cache', async (request, reply) => {
|
||||
const body = request.body || {}
|
||||
if (body.content) {
|
||||
const dir = 'resources/ChatGPTCache/page'
|
||||
const filename = body.entry + '.json'
|
||||
const filepath = path.join(dir, filename)
|
||||
const regexUrl = /\b((?:https?|ftp|file):\/\/[-a-zA-Z0-9+&@#\/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#\/%=~_|])/g
|
||||
const ip = await getPublicIP()
|
||||
try {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
fs.writeFileSync(filepath, JSON.stringify({
|
||||
user: body.content.senderName,
|
||||
bot: (body.bing ? 'Bing' : 'ChatGPT'),
|
||||
userImg: body.userImg || '',
|
||||
botImg: body.botImg || '',
|
||||
question: body.content.prompt,
|
||||
message: body.content.content,
|
||||
group: body.content.group,
|
||||
herf: `http://${body.cacheHost || ip}:${Config.serverPort || 3321}/page/${body.entry}`,
|
||||
quote: body.content.quote,
|
||||
images: body.content.images || [],
|
||||
suggest: body.content.suggest || [],
|
||||
time: new Date()
|
||||
}))
|
||||
reply.send({ file: body.entry, cacheUrl: `http://${ip}:${Config.serverPort || 3321}/page/${body.entry}` })
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
reply.send({ file: body.entry, cacheUrl: `http://${ip}/page/${body.entry}`, error: '生成失败' })
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
server.listen({
|
||||
port: Config.serverPort || 3321,
|
||||
host: '0.0.0.0'
|
||||
}, (error) => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
}
|
||||
server.log.info(`server listening on ${server.server.address().port}`)
|
||||
})
|
||||
})
|
||||
server.post('/cache', async (request, reply) => {
|
||||
const body = request.body || {}
|
||||
if (body.content) {
|
||||
const dir = 'resources/ChatGPTCache/page'
|
||||
const filename = body.entry + '.json'
|
||||
const filepath = path.join(dir, filename)
|
||||
const regexUrl = /\b((?:https?|ftp|file):\/\/[-a-zA-Z0-9+&@#\/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#\/%=~_|])/g
|
||||
const ip = await getPublicIP()
|
||||
try {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
fs.writeFileSync(filepath, JSON.stringify({
|
||||
user: body.content.senderName,
|
||||
bot: (body.bing ? 'Bing' : 'ChatGPT'),
|
||||
userImg: body.userImg || '',
|
||||
botImg: body.botImg || '',
|
||||
question: body.content.prompt,
|
||||
message: body.content.content,
|
||||
group: body.content.group,
|
||||
herf: `http://${body.cacheHost || (ip + ':' + Config.serverPort || 3321)}/page/${body.entry}`,
|
||||
quote: body.content.quote,
|
||||
images: body.content.images || [],
|
||||
suggest: body.content.suggest || [],
|
||||
time: new Date()
|
||||
}))
|
||||
reply.send({ file: body.entry, cacheUrl: `http://${ip}:${Config.serverPort || 3321}/page/${body.entry}` })
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
reply.send({ file: body.entry, cacheUrl: `http://${ip}/page/${body.entry}`, error: '生成失败' })
|
||||
}
|
||||
}
|
||||
})
|
||||
server.listen({
|
||||
port: Config.serverPort || 3321,
|
||||
host: '0.0.0.0'
|
||||
}, (error) => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
}
|
||||
server.log.info(`server listening on ${server.server.address().port}`)
|
||||
})
|
||||
}
|
||||
|
|
@ -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.eaab4ef2.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><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>
|
||||
21
server/static/js/app.6b32cca7.js
Normal file
21
server/static/js/app.6b32cca7.js
Normal file
File diff suppressed because one or more lines are too long
1
server/static/js/app.6b32cca7.js.map
Normal file
1
server/static/js/app.6b32cca7.js.map
Normal file
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
|
|
@ -318,7 +318,7 @@ export async function renderUrl (e, url, renderCfg = {}) {
|
|||
base64 = segment.image(buff)
|
||||
await page.close().catch((err) => logger.error(err))
|
||||
} catch (error) {
|
||||
logger.error(`图片生成失败:${this.model}:${error}`)
|
||||
logger.error(`${url}图片生成失败:${error}`)
|
||||
/** 关闭浏览器 */
|
||||
if (puppeteer.browser) {
|
||||
await puppeteer.browser.close().catch((err) => logger.error(err))
|
||||
|
|
|
|||
|
|
@ -81,6 +81,9 @@ const defaultConfig = {
|
|||
enforceMaster: false,
|
||||
preview: false,
|
||||
serverPort: 3321,
|
||||
serverHost: '',
|
||||
viewHost: '',
|
||||
chatViewWidth: 1280,
|
||||
version: 'v2.4.12'
|
||||
}
|
||||
const _path = process.cwd()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue