mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 05:17:10 +00:00
feat: add prompt block words
This commit is contained in:
parent
0365a3a09f
commit
f235552e2b
3 changed files with 10 additions and 2 deletions
|
|
@ -12,8 +12,8 @@ import { KeyvFile } from 'keyv-file'
|
|||
import { OfficialChatGPTClient } from '../utils/message.js'
|
||||
import fetch from 'node-fetch'
|
||||
import { deleteConversation, getConversations, getLatestMessageIdByConversationId } from '../utils/conversation.js'
|
||||
import cfg from '../../../lib/config/config.js'
|
||||
const blockWords = Config.blockWords
|
||||
const promptBlockWords = Config.promptBlockWords
|
||||
|
||||
/**
|
||||
* 每个对话保留的时长。单个对话内ai是保留上下文的。超时后销毁对话,再次对话创建新的对话。
|
||||
|
|
@ -274,7 +274,12 @@ export class chatgpt extends plugin {
|
|||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 检索是否有屏蔽词
|
||||
const promtBlockWord = promptBlockWords.find(word => prompt.toLowerCase().includes(word.toLowerCase()))
|
||||
if (promtBlockWord) {
|
||||
await this.reply('主人不让我回答你这种问题,真是抱歉了呢', true)
|
||||
return false
|
||||
}
|
||||
// if (prompt.indexOf('<script>') != -1)
|
||||
// {
|
||||
// await this.reply('坏人,我要报告给主人', e.isGroup)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ export default {
|
|||
// ***********************************************************************************************************************************
|
||||
// 如果回答包括屏蔽词,就不返回。
|
||||
// blockWords: ['屏蔽词1', '屏蔽词b'],
|
||||
// 问题中如果触发屏蔽词,也会拒绝回答
|
||||
// promptBlockWords: ['屏蔽词1', '屏蔽词b'],
|
||||
// 改为true后,全局默认以图片形式回复,并自动发出Continue命令补全回答。长回复可能会有bug。
|
||||
// defaultUsePicture: false,
|
||||
// 如果true,字数大于阈值(autoUsePictureThreshold)会自动用图片发送,即使是文本模式。
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import fs from 'fs'
|
||||
const defaultConfig = {
|
||||
blockWords: ['屏蔽词1', '屏蔽词b'],
|
||||
promptBlockWords: ['屏蔽词1', '屏蔽词b'],
|
||||
defaultUsePicture: false,
|
||||
autoUsePicture: true,
|
||||
autoUsePictureThreshold: 1200,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue