mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
修复bug (#175)
* 修复引用转发,默认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 * 防止script攻击 * 修复网页模板错误 * 修复bing页面引用错误 * 缓存服务器异常时处理 * 添加默认配置加载 * 修复配置文件路径错误 * 删除重复的模板文件,修复二维码地址错误 * 修正图片渲染错误 * 修复引用渲染错误 * 二维码网址统一改为使用本地配置 * 添加关闭思考提示的配置项 * 修复在Windows上无法载入配置文件的问题 * 修复关闭qr的情况下渲染错误 --------- Co-authored-by: ikechan8370 <geyinchibuaa@gmail.com>
This commit is contained in:
parent
0b945291c4
commit
59d5e904b5
4 changed files with 15 additions and 12 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,3 +1,3 @@
|
|||
config/*
|
||||
!config/config.example.js
|
||||
node_modules/
|
||||
node_modules/
|
||||
|
|
|
|||
18
apps/chat.js
18
apps/chat.js
|
|
@ -288,7 +288,7 @@ export class chatgpt extends plugin {
|
|||
// 队列队尾插入,开始排队
|
||||
await redis.rPush('CHATGPT:CHAT_QUEUE', [randomId])
|
||||
let confirm = await redis.get('CHATGPT:CONFIRM')
|
||||
let confirmOn = !confirm || confirm === 'on'
|
||||
let confirmOn = (!confirm || confirm === 'on') && Config.thinkingTips
|
||||
if (await redis.lIndex('CHATGPT:CHAT_QUEUE', 0) === randomId) {
|
||||
if (confirmOn) {
|
||||
await this.reply('我正在思考如何回复你,请稍等', true, { recallMsg: 8 })
|
||||
|
|
@ -468,12 +468,12 @@ export class chatgpt extends plugin {
|
|||
}
|
||||
)
|
||||
let cache = {file:'',cacheUrl:Config.cacheUrl}
|
||||
if (cacheres.ok)
|
||||
cache = await cacheres.json()
|
||||
cache.cacheUrl = Config.cacheUrl
|
||||
if (cacheres.ok) {
|
||||
cache = Object.assign({}, cache, await cacheres.json())
|
||||
}
|
||||
await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: escapeHtml(response), prompt: escapeHtml(prompt), senderName: e.sender.nickname, cache: cache })
|
||||
} else {
|
||||
await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: escapeHtml(response), prompt: escapeHtml(prompt), senderName: e.sender.nickname })
|
||||
await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: escapeHtml(response), prompt: escapeHtml(prompt), senderName: e.sender.nickname, cache: {file:'',cacheUrl:Config.cacheUrl} })
|
||||
}
|
||||
} else {
|
||||
let quotemessage = []
|
||||
|
|
@ -504,12 +504,12 @@ export class chatgpt extends plugin {
|
|||
}
|
||||
)
|
||||
let cache = {file:'',cacheUrl:Config.cacheUrl}
|
||||
if (cacheres.ok)
|
||||
cache = await cacheres.json()
|
||||
cache.cacheUrl = Config.cacheUrl
|
||||
if (cacheres.ok) {
|
||||
cache = Object.assign({}, cache, await cacheres.json())
|
||||
}
|
||||
await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: escapeHtml(response), prompt: escapeHtml(prompt), senderName: e.sender.nickname, quote: quotemessage.length > 0 , quotes: quotemessage, cache: cache })
|
||||
} else {
|
||||
await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: escapeHtml(response), prompt: escapeHtml(prompt), senderName: e.sender.nickname, quote: quotemessage.length > 0 , quotes: quotemessage })
|
||||
await e.runtime.render('chatgpt-plugin', use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index', { content: escapeHtml(response), prompt: escapeHtml(prompt), senderName: e.sender.nickname, quote: quotemessage.length > 0 , quotes: quotemessage, cache: {file:'',cacheUrl:Config.cacheUrl} })
|
||||
}
|
||||
} else {
|
||||
await this.reply(`${response}`, e.isGroup)
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ export default {
|
|||
// promptPrefixOverride: 'Your answer shouldn\'t be too verbose. If you are generating a list, do not have too many items. Keep the number of items short. Prefer to answer in Chinese.',
|
||||
// AI认为的自己的名字,当你问他你是谁是他会回答这里的名字。
|
||||
// assistantLabel: 'ChatGPT',
|
||||
// 是否开启AI正在思考中的提示信息
|
||||
// thinkingTips: true,
|
||||
// ***********************************************************************************************************************************
|
||||
// 以下为浏览器方式的配置 *
|
||||
// ***********************************************************************************************************************************
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ const defaultConfig = {
|
|||
reverseProxy: 'https://chatgpt.pawan.krd/api/completions',
|
||||
promptPrefixOverride: 'Your answer shouldn\'t be too verbose. If you are generating a list, do not have too many items. Keep the number of items short. Prefer to answer in Chinese.',
|
||||
assistantLabel: 'ChatGPT',
|
||||
thinkingTips: true,
|
||||
username: '',
|
||||
password: '',
|
||||
headless: false,
|
||||
|
|
@ -30,11 +31,11 @@ const _path = process.cwd()
|
|||
let config = {}
|
||||
if (fs.existsSync(`${_path}/plugins/chatgpt-plugin/config/config.js`)) {
|
||||
const fullPath = fs.realpathSync(`${_path}/plugins/chatgpt-plugin/config/config.js`);
|
||||
config = (await import(fullPath)).default;
|
||||
config = (await import(`file://${fullPath}`)).default;
|
||||
} else if (fs.existsSync(`${_path}/plugins/chatgpt-plugin/config/index.js`)) {
|
||||
// 兼容旧版本
|
||||
const fullPath = fs.realpathSync(`${_path}/plugins/chatgpt-plugin/config/index.js`);
|
||||
config = (await import(fullPath)).Config;
|
||||
config = (await import(`file://${fullPath}`)).Config;
|
||||
}
|
||||
|
||||
export const Config = Object.assign({}, defaultConfig, config);
|
||||
Loading…
Add table
Add a link
Reference in a new issue