mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
新增查看插件指令表的功能,修复配置群聊黑白名单的bug,修复开启禁用私聊后仍可以使用#chat模式进行对话的bug (#366)
* feat: add support for ‘greeting’ and ‘global reply mode’ commands, improve variable naming and remove unnecessary backend output. * feat: Add support for black and white lists, global reply mode and voice role settings, private chat switch, and active greeting configuration. Refactor some variable names and comment out redundant code for better readability and reduced backend output. * feat: 为新功能完善了帮助面板 * docs: 完善了‘打招呼’的帮助说明 * Commit Type: feat, bugfix Add functionality to view plugin command table, fix bug in blacklist/whitelist, and fix bug where chat mode can still be used in private messaging when disabled. * Commit Type: feat, bugfix Add functionality to view plugin command table, fix bug in blacklist/whitelist, and fix bug where chat mode can still be used in private messaging when disabled. * refactor: Remove redundant log output. * Refactor: optimize code logic --------- Co-authored-by: Sean <1519059137@qq.com> Co-authored-by: ikechan8370 <geyinchibuaa@gmail.com>
This commit is contained in:
parent
2dc7cd5c29
commit
351d89bd7c
7 changed files with 190 additions and 87 deletions
59
apps/chat.js
59
apps/chat.js
|
|
@ -26,8 +26,8 @@ import { convertSpeaker, generateAudio, speakers } from '../utils/tts.js'
|
|||
import ChatGLMClient from '../utils/chatglm.js'
|
||||
import { convertFaces } from '../utils/face.js'
|
||||
import uploadRecord from '../utils/uploadRecord.js'
|
||||
import {SlackClaudeClient} from "../utils/slack/slackClient.js";
|
||||
import {getPromptByName} from "../utils/prompts.js";
|
||||
import { SlackClaudeClient } from "../utils/slack/slackClient.js"
|
||||
import { ChatgptManagement } from './management.js'
|
||||
try {
|
||||
await import('keyv')
|
||||
} catch (err) {
|
||||
|
|
@ -60,10 +60,10 @@ try {
|
|||
const defaultPropmtPrefix = ', a large language model trained by OpenAI. You answer as concisely as possible for each response (e.g. don’t be verbose). It is very important that you answer as concisely as possible, so please remember this. If you are generating a list, do not have too many items. Keep the number of items short.'
|
||||
const newFetch = (url, options = {}) => {
|
||||
const defaultOptions = Config.proxy
|
||||
? {
|
||||
? {
|
||||
agent: proxy(Config.proxy)
|
||||
}
|
||||
: {}
|
||||
: {}
|
||||
const mergedOptions = {
|
||||
...defaultOptions,
|
||||
...options
|
||||
|
|
@ -76,9 +76,9 @@ export class chatgpt extends plugin {
|
|||
let toggleMode = Config.toggleMode
|
||||
super({
|
||||
/** 功能名称 */
|
||||
name: 'chatgpt',
|
||||
name: 'ChatGpt 对话',
|
||||
/** 功能描述 */
|
||||
dsc: 'chatgpt from openai',
|
||||
dsc: '与人工智能对话,畅聊无限可能~',
|
||||
event: 'message',
|
||||
/** 优先级,数字越小等级越高 */
|
||||
priority: 1144,
|
||||
|
|
@ -549,15 +549,18 @@ export class chatgpt extends plugin {
|
|||
*/
|
||||
async chatgpt (e) {
|
||||
if (!e.isMaster && e.isPrivate && !Config.enablePrivateChat) {
|
||||
this.reply('ChatGpt私聊通道已关闭。')
|
||||
await this.reply('ChatGpt私聊通道已关闭。')
|
||||
return false
|
||||
}
|
||||
if (e.isGroup) {
|
||||
const whitelist = Config.groupWhitelist.filter(group => group.trim())
|
||||
let cm = new ChatgptManagement()
|
||||
let [groupWhitelist, groupBlacklist] = await cm.processList(Config.groupWhitelist, Config.groupBlacklist)
|
||||
// logger.info('groupWhitelist:', Config.groupWhitelist, 'groupBlacklist', Config.groupBlacklist)
|
||||
const whitelist = groupWhitelist.filter(group => group.trim())
|
||||
if (whitelist.length > 0 && !whitelist.includes(e.group_id.toString())) {
|
||||
return false
|
||||
}
|
||||
const blacklist = Config.groupBlacklist.filter(group => group.trim())
|
||||
const blacklist = groupBlacklist.filter(group => group.trim())
|
||||
if (blacklist.length > 0 && blacklist.includes(e.group_id.toString())) {
|
||||
return false
|
||||
}
|
||||
|
|
@ -974,6 +977,10 @@ export class chatgpt extends plugin {
|
|||
}
|
||||
|
||||
async chatgpt1 (e) {
|
||||
if (!e.isMaster && e.isPrivate && !Config.enablePrivateChat) {
|
||||
await this.reply('ChatGpt私聊通道已关闭。')
|
||||
return false
|
||||
}
|
||||
if (!Config.allowOtherMode) {
|
||||
return false
|
||||
}
|
||||
|
|
@ -993,6 +1000,10 @@ export class chatgpt extends plugin {
|
|||
}
|
||||
|
||||
async chatgpt3 (e) {
|
||||
if (!e.isMaster && e.isPrivate && !Config.enablePrivateChat) {
|
||||
await this.reply('ChatGpt私聊通道已关闭。')
|
||||
return false
|
||||
}
|
||||
if (!Config.allowOtherMode) {
|
||||
return false
|
||||
}
|
||||
|
|
@ -1031,6 +1042,10 @@ export class chatgpt extends plugin {
|
|||
}
|
||||
|
||||
async bing (e) {
|
||||
if (!e.isMaster && e.isPrivate && !Config.enablePrivateChat) {
|
||||
await this.reply('ChatGpt私聊通道已关闭。')
|
||||
return false
|
||||
}
|
||||
if (!Config.allowOtherMode) {
|
||||
return false
|
||||
}
|
||||
|
|
@ -1598,19 +1613,19 @@ export class chatgpt extends plugin {
|
|||
Authorization: 'Bearer ' + Config.apiKey
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.error) {
|
||||
this.reply('获取失败:' + data.error.code)
|
||||
return false
|
||||
} else {
|
||||
let total_granted = data.total_granted.toFixed(2)
|
||||
let total_used = data.total_used.toFixed(2)
|
||||
let total_available = data.total_available.toFixed(2)
|
||||
let expires_at = new Date(data.grants.data[0].expires_at * 1000).toLocaleDateString().replace(/\//g, '-')
|
||||
this.reply('总额度:$' + total_granted + '\n已经使用额度:$' + total_used + '\n当前剩余额度:$' + total_available + '\n到期日期(UTC):' + expires_at)
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.error) {
|
||||
this.reply('获取失败:' + data.error.code)
|
||||
return false
|
||||
} else {
|
||||
let total_granted = data.total_granted.toFixed(2)
|
||||
let total_used = data.total_used.toFixed(2)
|
||||
let total_available = data.total_available.toFixed(2)
|
||||
let expires_at = new Date(data.grants.data[0].expires_at * 1000).toLocaleDateString().replace(/\//g, '-')
|
||||
this.reply('总额度:$' + total_granted + '\n已经使用额度:$' + total_used + '\n当前剩余额度:$' + total_available + '\n到期日期(UTC):' + expires_at)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ export class dalle extends plugin {
|
|||
}
|
||||
try {
|
||||
let images = (await editImage(imgUrl, position.split(',').map(p => parseInt(p, 10)), prompt, num, size))
|
||||
.map(image => segment.image(`base64://${image}`))
|
||||
.map(image => segment.image(`base64://${image}`))
|
||||
if (images.length > 1) {
|
||||
this.reply(await makeForwardMsg(e, images, prompt))
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ try {
|
|||
export class Entertainment extends plugin {
|
||||
constructor (e) {
|
||||
super({
|
||||
name: 'ChatGPT-Plugin娱乐小功能',
|
||||
dsc: 'ChatGPT-Plugin娱乐小功能',
|
||||
name: 'ChatGPT-Plugin 娱乐小功能',
|
||||
dsc: '让你的聊天更有趣!现已支持主动打招呼和表情合成小功能!',
|
||||
event: 'message',
|
||||
priority: 500,
|
||||
rule: [
|
||||
|
|
@ -221,8 +221,8 @@ export class Entertainment extends plugin {
|
|||
return false
|
||||
} else {
|
||||
Config.initiativeChatGroups = Config.initiativeChatGroups
|
||||
.filter(group => group.trim() !== '')
|
||||
.concat(validGroups)
|
||||
.filter(group => group.trim() !== '')
|
||||
.concat(validGroups)
|
||||
}
|
||||
if (typeof paramArray[2] === 'undefined' && typeof paramArray[3] === 'undefined') {
|
||||
replyMsg = `已更新打招呼设置:\n${!e.isGroup ? '群号:' + Config.initiativeChatGroups.join(', ') + '\n' : ''}间隔时间:${Config.helloInterval}小时\n触发概率:${Config.helloProbability}%`
|
||||
|
|
|
|||
|
|
@ -303,8 +303,8 @@ let helpData = [
|
|||
export class help extends plugin {
|
||||
constructor (e) {
|
||||
super({
|
||||
name: 'ChatGPT-Plugin帮助',
|
||||
dsc: 'ChatGPT-Plugin帮助',
|
||||
name: 'ChatGPT-Plugin 帮助',
|
||||
dsc: 'ChatGPT-Plugin 帮助面板',
|
||||
event: 'message',
|
||||
priority: 500,
|
||||
rule: [
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ async function getKeyv () {
|
|||
export class history extends plugin {
|
||||
constructor (e) {
|
||||
super({
|
||||
name: 'ChatGPT-Plugin聊天记录',
|
||||
dsc: 'ChatGPT-Plugin聊天记录提取',
|
||||
name: 'ChatGPT-Plugin 聊天记录',
|
||||
dsc: '让你的聊天更加便捷!本插件支持以图片的形式导出本次对话的聊天记录,方便随时分享精彩瞬间!',
|
||||
event: 'message',
|
||||
priority: 500,
|
||||
rule: [
|
||||
{
|
||||
reg: '^#(chatgpt|ChatGPT)(导出)?聊天记录',
|
||||
reg: '^#(chatgpt|ChatGPT)(导出)?聊天记录$',
|
||||
fnc: 'history'
|
||||
}
|
||||
]
|
||||
|
|
@ -65,12 +65,12 @@ export class history extends plugin {
|
|||
let parentMessageId = previousConversation.parentMessageId
|
||||
let tmp = {}
|
||||
const previousCachedMessages = getMessagesForConversation(conversation.messages, parentMessageId)
|
||||
.map((message) => {
|
||||
return {
|
||||
text: message.message,
|
||||
author: message.role === 'User' ? 'user' : 'bot'
|
||||
}
|
||||
})
|
||||
.map((message) => {
|
||||
return {
|
||||
text: message.message,
|
||||
author: message.role === 'User' ? 'user' : 'bot'
|
||||
}
|
||||
})
|
||||
previousCachedMessages.forEach(m => {
|
||||
if (m.author === 'user') {
|
||||
tmp.prompt = m.text
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ import { convertSpeaker, speakers } from '../utils/tts.js'
|
|||
import md5 from 'md5'
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
|
||||
import loader from '../../../lib/plugins/loader.js'
|
||||
let isWhiteList = true
|
||||
export class ChatgptManagement extends plugin {
|
||||
constructor (e) {
|
||||
super({
|
||||
name: 'ChatGPT-Plugin管理',
|
||||
dsc: 'ChatGPT-Plugin管理',
|
||||
name: 'ChatGPT-Plugin 管理',
|
||||
dsc: '插件的管理项配置,让你轻松掌控各个功能的开闭和管理。包含各种实用的配置选项,让你的聊天更加便捷和高效!',
|
||||
event: 'message',
|
||||
priority: 500,
|
||||
rule: [
|
||||
|
|
@ -204,11 +204,88 @@ export class ChatgptManagement extends plugin {
|
|||
{
|
||||
reg: '^#chatgpt用户(设置|配置|管理)',
|
||||
fnc: 'userPage'
|
||||
},
|
||||
{
|
||||
reg: '^#chatgpt(对话|管理|娱乐|绘图|人物设定|聊天记录)?指令表(帮助)?',
|
||||
fnc: 'commandHelp',
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
async commandHelp (e) {
|
||||
if (!this.e.isMaster) { return this.reply('你没有权限') }
|
||||
if (e.msg.trim() === '#chatgpt指令表帮助') {
|
||||
await this.reply('#chatgpt指令表: 查看本插件的所有指令\n' +
|
||||
'#chatgpt(对话|管理|娱乐|绘图|人物设定|聊天记录)指令表: 查看对应功能分类的指令表')
|
||||
return false
|
||||
}
|
||||
const categories = {
|
||||
对话: '对话',
|
||||
管理: '管理',
|
||||
娱乐: '娱乐',
|
||||
绘图: '绘图',
|
||||
人物设定: '人物设定',
|
||||
聊天记录: '聊天记录'
|
||||
}
|
||||
|
||||
function getCategory (e, plugin) {
|
||||
for (const key in categories) {
|
||||
if (e.msg.includes(key) && plugin.name.includes(categories[key])) {
|
||||
return '功能名称: '
|
||||
}
|
||||
}
|
||||
return ''
|
||||
}
|
||||
const commandSet = []
|
||||
const plugins = await Promise.all(loader.priority.map(p => new p.class()))
|
||||
|
||||
for (const plugin of plugins) {
|
||||
const name = plugin.name
|
||||
const rule = plugin.rule
|
||||
if (/^chatgpt/i.test(name) && rule) {
|
||||
commandSet.push({ name, dsc: plugin.dsc, rule })
|
||||
}
|
||||
}
|
||||
|
||||
const generatePrompt = (plugin, command) => {
|
||||
const category = getCategory(e, plugin)
|
||||
const commandsStr = command.length ? `正则指令:\n${command.join('\n')}\n` : '正则指令: 无\n'
|
||||
const description = `功能介绍:${plugin.dsc}\n`
|
||||
return `${category}${plugin.name}\n${description}${commandsStr}`
|
||||
}
|
||||
|
||||
const prompts = []
|
||||
for (const plugin of commandSet) {
|
||||
const commands = plugin.rule.map(v => v.reg.includes('[#*0-9]') ? '表情合成功能只需要发送两个emoji表情即可' : v.reg)
|
||||
const category = getCategory(e, plugin)
|
||||
if (category || (!e.msg.includes('对话') && !e.msg.includes('管理') && !e.msg.includes('娱乐') && !e.msg.includes('绘图') && !e.msg.includes('人物设定') && !e.msg.includes('聊天记录'))) {
|
||||
prompts.push(generatePrompt(plugin, commands))
|
||||
}
|
||||
}
|
||||
|
||||
await this.reply(prompts.join('\n'))
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* 对原始黑白名单进行去重和去除无效群号处理
|
||||
* @param whitelist
|
||||
* @param blacklist
|
||||
* @returns {Promise<any[][]>}
|
||||
*/
|
||||
async processList (whitelist, blacklist) {
|
||||
let groupWhitelist = Array.isArray(whitelist)
|
||||
? whitelist
|
||||
: String(whitelist).split(/[,,]/)
|
||||
let groupBlacklist = !Array.isArray(blacklist)
|
||||
? blacklist
|
||||
: String(blacklist).split(/[,,]/)
|
||||
groupWhitelist = Array.from(new Set(groupWhitelist)).filter(value => /^[1-9]\d{8,9}$/.test(value))
|
||||
groupBlacklist = Array.from(new Set(groupBlacklist)).filter(value => /^[1-9]\d{8,9}$/.test(value))
|
||||
return [groupWhitelist, groupBlacklist]
|
||||
}
|
||||
|
||||
async setList (e) {
|
||||
this.setContext('saveList')
|
||||
isWhiteList = e.msg.includes('白')
|
||||
|
|
@ -219,39 +296,45 @@ export class ChatgptManagement extends plugin {
|
|||
|
||||
async saveList (e) {
|
||||
if (!this.e.msg) return
|
||||
const groupNums = this.e.msg.match(/\d+/g)
|
||||
const groupList = Array.isArray(groupNums) ? this.e.msg.match(/\d+/g).filter(value => /^[1-9]\d{8,9}/.test(value)) : []
|
||||
if (!groupList.length) {
|
||||
await this.reply('没有可添加的群号,请检查群号是否正确', e.isGroup)
|
||||
const listType = isWhiteList ? '白名单' : '黑名单'
|
||||
const inputMatch = this.e.msg.match(/\d+/g)
|
||||
let [groupWhitelist, groupBlacklist] = await this.processList(Config.groupWhitelist, Config.groupBlacklist)
|
||||
let inputList = Array.isArray(inputMatch) ? this.e.msg.match(/\d+/g).filter(value => /^[1-9]\d{8,9}$/.test(value)) : []
|
||||
if (!inputList.length) {
|
||||
await this.reply('无效输入,请在检查群号是否正确后重新输入', e.isGroup)
|
||||
return false
|
||||
}
|
||||
inputList = Array.from(new Set(inputList))
|
||||
let whitelist = []
|
||||
let blacklist = []
|
||||
for (const element of groupList) {
|
||||
if (isWhiteList) {
|
||||
Config.groupWhitelist = Config.groupWhitelist.filter(item => item !== element)
|
||||
for (const element of inputList) {
|
||||
if (listType === '白名单') {
|
||||
groupWhitelist = groupWhitelist.filter(item => item !== element)
|
||||
whitelist.push(element)
|
||||
} else {
|
||||
Config.groupBlacklist = Config.groupBlacklist.filter(item => item !== element)
|
||||
groupBlacklist = groupBlacklist.filter(item => item !== element)
|
||||
blacklist.push(element)
|
||||
}
|
||||
}
|
||||
if (!(whitelist.length || blacklist.length)) {
|
||||
await this.reply('没有可添加的群号,请检查群号是否正确或重复添加', e.isGroup)
|
||||
this.finish('saveList')
|
||||
await this.reply('无效输入,请在检查群号是否正确或重复添加后重新输入', e.isGroup)
|
||||
return false
|
||||
} else {
|
||||
if (isWhiteList) {
|
||||
Config.groupWhitelist = Config.groupWhitelist
|
||||
.filter(group => group.trim() !== '')
|
||||
.concat(whitelist)
|
||||
if (listType === '白名单') {
|
||||
Config.groupWhitelist = groupWhitelist
|
||||
.filter(group => group !== '')
|
||||
.concat(whitelist)
|
||||
} else {
|
||||
Config.groupBlacklist = Config.groupBlacklist
|
||||
.filter(group => group.trim() !== '')
|
||||
.concat(blacklist)
|
||||
Config.groupBlacklist = groupBlacklist
|
||||
.filter(group => group !== '')
|
||||
.concat(blacklist)
|
||||
}
|
||||
}
|
||||
await this.reply(`群聊${isWhiteList ? '白' : '黑'}名单已更新,可通过\n'#chatgpt查看群聊${isWhiteList ? '白' : '黑'}名单'查看最新名单\n#chatgpt移除群聊${isWhiteList ? '白' : '黑'}名单'管理名单`, e.isGroup)
|
||||
let replyMsg = `群聊${listType}已更新,可通过\n'#chatgpt查看群聊${listType}'查看最新名单\n'#chatgpt移除群聊${listType}'管理名单`
|
||||
if (e.isPrivate) {
|
||||
replyMsg += `\n当前群聊${listType}为:${listType === '白名单' ? Config.groupWhitelist : Config.groupBlacklist}`
|
||||
}
|
||||
await this.reply(replyMsg, e.isGroup)
|
||||
this.finish('saveList')
|
||||
}
|
||||
|
||||
|
|
@ -259,8 +342,8 @@ export class ChatgptManagement extends plugin {
|
|||
isWhiteList = e.msg.includes('白')
|
||||
const list = isWhiteList ? Config.groupWhitelist : Config.groupBlacklist
|
||||
const listType = isWhiteList ? '白名单' : '黑名单'
|
||||
const replyMsg = list.length ? `当前群聊${listType}为:${list.join(',')}` : `当前没有设置任何${listType}`
|
||||
this.reply(replyMsg, e.isGroup)
|
||||
const replyMsg = list.length ? `当前群聊${listType}为:${list}` : `当前没有设置任何群聊${listType}`
|
||||
await this.reply(replyMsg, e.isGroup)
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
@ -268,9 +351,9 @@ export class ChatgptManagement extends plugin {
|
|||
isWhiteList = e.msg.includes('白')
|
||||
const listType = isWhiteList ? '白名单' : '黑名单'
|
||||
let replyMsg = ''
|
||||
if (Config.groupWhitelist.length && Config.groupBlacklist.length) {
|
||||
if (Config.groupWhitelist.length === 0 && Config.groupBlacklist.length === 0) {
|
||||
replyMsg = `当前群聊(白|黑)名单为空,请先添加${listType}吧~`
|
||||
} else if ((isWhiteList && !Config.groupWhitelist.length) || (!isWhiteList && !Config.groupBlacklist.length)) {
|
||||
} else if ((listType === '白名单' && !Config.groupWhitelist.length) || (listType === '黑名单' && !Config.groupBlacklist.length)) {
|
||||
replyMsg = `当前群聊${listType}为空,请先添加吧~`
|
||||
}
|
||||
if (replyMsg) {
|
||||
|
|
@ -286,27 +369,32 @@ export class ChatgptManagement extends plugin {
|
|||
if (!this.e.msg) return
|
||||
const isAllDeleted = this.e.msg.trim() === '全部删除'
|
||||
const groupNumRegex = /^[1-9]\d{8,9}$/
|
||||
const groupNums = this.e.msg.match(/\d+/g)
|
||||
const validGroups = Array.isArray(groupNums) ? groupNums.filter(groupNum => groupNumRegex.test(groupNum)) : []
|
||||
const inputMatch = this.e.msg.match(/\d+/g)
|
||||
const validGroups = Array.isArray(inputMatch) ? inputMatch.filter(groupNum => groupNumRegex.test(groupNum)) : []
|
||||
let [groupWhitelist, groupBlacklist] = await this.processList(Config.groupWhitelist, Config.groupBlacklist)
|
||||
if (isAllDeleted) {
|
||||
Config.groupWhitelist = isWhiteList ? [] : Config.groupWhitelist
|
||||
Config.groupBlacklist = !isWhiteList ? [] : Config.groupBlacklist
|
||||
Config.groupWhitelist = isWhiteList ? [] : groupWhitelist
|
||||
Config.groupBlacklist = !isWhiteList ? [] : groupBlacklist
|
||||
} else {
|
||||
if (!validGroups.length) {
|
||||
await this.reply('没有可删除的群号,请检查输入的群号是否正确', e.isGroup)
|
||||
await this.reply('无效输入,请在检查群号是否正确后重新输入', e.isGroup)
|
||||
return false
|
||||
} else {
|
||||
for (const element of validGroups) {
|
||||
if (isWhiteList) {
|
||||
Config.groupWhitelist = Config.groupWhitelist.filter(item => item !== element)
|
||||
Config.groupWhitelist = groupWhitelist.filter(item => item !== element)
|
||||
} else {
|
||||
Config.groupBlacklist = Config.groupBlacklist.filter(item => item !== element)
|
||||
Config.groupBlacklist = groupBlacklist.filter(item => item !== element)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const groupType = isWhiteList ? '白' : '黑'
|
||||
await this.reply(`群聊${groupType}名单已更新,可通过'#chatgpt查看群聊${groupType}名单'命令查看最新名单`)
|
||||
const listType = isWhiteList ? '白名单' : '黑名单'
|
||||
let replyMsg = `群聊${listType}已更新,可通过'#chatgpt查看群聊${listType}'命令查看最新名单`
|
||||
if (e.isPrivate) {
|
||||
replyMsg += `\n当前群聊${listType}为:${listType === '白名单' ? Config.groupWhitelist : Config.groupBlacklist}`
|
||||
}
|
||||
await this.reply(replyMsg, e.isGroup)
|
||||
this.finish('confirmDelGroup')
|
||||
}
|
||||
|
||||
|
|
@ -449,11 +537,11 @@ export class ChatgptManagement extends plugin {
|
|||
if (token) {
|
||||
token = token.split('|')
|
||||
token = token.map((item, index) => (
|
||||
{
|
||||
Token: item,
|
||||
State: '正常',
|
||||
Usage: 0
|
||||
}
|
||||
{
|
||||
Token: item,
|
||||
State: '正常',
|
||||
Usage: 0
|
||||
}
|
||||
))
|
||||
} else {
|
||||
token = []
|
||||
|
|
@ -473,10 +561,10 @@ export class ChatgptManagement extends plugin {
|
|||
if (tokens) tokens = JSON.parse(tokens)
|
||||
else tokens = []
|
||||
tokens = tokens.length > 0
|
||||
? tokens.map((item, index) => (
|
||||
`【${index}】 Token:${item.Token.substring(0, 5 / 2) + '...' + item.Token.substring(item.Token.length - 5 / 2, item.Token.length)}`
|
||||
)).join('\n')
|
||||
: '无必应Token记录'
|
||||
? tokens.map((item, index) => (
|
||||
`【${index}】 Token:${item.Token.substring(0, 5 / 2) + '...' + item.Token.substring(item.Token.length - 5 / 2, item.Token.length)}`
|
||||
)).join('\n')
|
||||
: '无必应Token记录'
|
||||
await this.reply(`${tokens}`, true)
|
||||
return false
|
||||
}
|
||||
|
|
@ -487,10 +575,10 @@ export class ChatgptManagement extends plugin {
|
|||
if (tokens) tokens = JSON.parse(tokens)
|
||||
else tokens = []
|
||||
tokens = tokens.length > 0
|
||||
? tokens.map((item, index) => (
|
||||
`【${index}】 Token:${item.Token.substring(0, 5 / 2) + '...' + item.Token.substring(item.Token.length - 5 / 2, item.Token.length)}`
|
||||
)).join('\n')
|
||||
: '无必应Token记录'
|
||||
? tokens.map((item, index) => (
|
||||
`【${index}】 Token:${item.Token.substring(0, 5 / 2) + '...' + item.Token.substring(item.Token.length - 5 / 2, item.Token.length)}`
|
||||
)).join('\n')
|
||||
: '无必应Token记录'
|
||||
await this.reply(`请发送要删除的token编号\n${tokens}`, true)
|
||||
if (tokens.length == 0) this.finish('saveBingToken')
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import { deleteOnePrompt, getPromptByName, readPrompts, saveOnePrompt } from '..
|
|||
export class help extends plugin {
|
||||
constructor (e) {
|
||||
super({
|
||||
name: 'ChatGPT-Plugin 设定管理',
|
||||
dsc: 'ChatGPT-Plugin 设定管理',
|
||||
name: 'ChatGPT-Plugin 人物设定',
|
||||
dsc: '让你的聊天更加有趣!本插件支持丰富的人物设定拓展,可以在线浏览并导入喜欢的设定和上传自己的设定。让你的聊天更加生动有趣!',
|
||||
event: 'message',
|
||||
priority: 500,
|
||||
rule: [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue