mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 05:47:11 +00:00
防止注入攻击 (#170)
* 修复引用转发,默认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攻击 --------- Co-authored-by: ikechan8370 <geyinchibuaa@gmail.com>
This commit is contained in:
parent
624e1f6e1a
commit
c07503db29
1 changed files with 9 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ import { KeyvFile } from 'keyv-file'
|
||||||
import { OfficialChatGPTClient } from '../utils/message.js'
|
import { OfficialChatGPTClient } from '../utils/message.js'
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
import { deleteConversation, getConversations, getLatestMessageIdByConversationId } from '../utils/conversation.js'
|
import { deleteConversation, getConversations, getLatestMessageIdByConversationId } from '../utils/conversation.js'
|
||||||
|
import cfg from '../../../lib/config/config.js'
|
||||||
const blockWords = Config.blockWords
|
const blockWords = Config.blockWords
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -273,6 +274,14 @@ export class chatgpt extends plugin {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prompt.indexOf('<script>') != -1)
|
||||||
|
{
|
||||||
|
await this.reply('坏人,我要报告给主人', e.isGroup)
|
||||||
|
Bot.pickUser(cfg.masterQQ[0]).sendMsg(`主人,我在${this.e.group_id ? '群' + this.e.group_id : '私聊' }被${e.sender.nickname}使用代码攻击了,请警惕`)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
const use = await redis.get('CHATGPT:USE')
|
const use = await redis.get('CHATGPT:USE')
|
||||||
if (use !== 'bing') {
|
if (use !== 'bing') {
|
||||||
let randomId = uuid()
|
let randomId = uuid()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue