mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
feat(bym): 添加默认配置并优化文件夹创建逻辑
This commit is contained in:
parent
3e70ae88dc
commit
aec89ef10f
2 changed files with 40 additions and 3 deletions
39
apps/bym.js
39
apps/bym.js
|
|
@ -16,7 +16,7 @@ import { EditCardTool } from '../utils/tools/EditCardTool.js'
|
||||||
import { JinyanTool } from '../utils/tools/JinyanTool.js'
|
import { JinyanTool } from '../utils/tools/JinyanTool.js'
|
||||||
import { KickOutTool } from '../utils/tools/KickOutTool.js'
|
import { KickOutTool } from '../utils/tools/KickOutTool.js'
|
||||||
import { SetTitleTool } from '../utils/tools/SetTitleTool.js'
|
import { SetTitleTool } from '../utils/tools/SetTitleTool.js'
|
||||||
import {SerpTool} from '../utils/tools/SerpTool.js'
|
import { SerpTool } from '../utils/tools/SerpTool.js'
|
||||||
|
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import { fileTypeFromBuffer } from 'file-type';
|
import { fileTypeFromBuffer } from 'file-type';
|
||||||
|
|
@ -25,6 +25,26 @@ import pathModule from 'path';
|
||||||
const _path = process.cwd();
|
const _path = process.cwd();
|
||||||
const path = _path + "/temp/tp-bq";
|
const path = _path + "/temp/tp-bq";
|
||||||
|
|
||||||
|
const DefaultConfig = {
|
||||||
|
returnQQ: [],
|
||||||
|
GroupList: [],
|
||||||
|
UserList: [],
|
||||||
|
enableBYM: true,
|
||||||
|
assistantLabel: ["ChatGPT"],
|
||||||
|
bymPreset: [],
|
||||||
|
bymFuckPrompt: "",
|
||||||
|
blockWords: [],
|
||||||
|
AutoToDownImg: false,
|
||||||
|
debug: false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fs.existsSync(path)) {
|
||||||
|
fs.mkdirSync(path, { recursive: true })
|
||||||
|
}
|
||||||
|
if (!fs.existsSync(pathModule.join(path, 'pictures'))) {
|
||||||
|
fs.mkdirSync(pathModule.join(path, 'pictures'), { recursive: true })
|
||||||
|
}
|
||||||
|
|
||||||
// 轻微黑名单用户
|
// 轻微黑名单用户
|
||||||
let RoleFalseUser = []
|
let RoleFalseUser = []
|
||||||
|
|
||||||
|
|
@ -45,6 +65,19 @@ export class bym extends plugin {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
if (typeof Config.assistantLabel === 'string') {
|
||||||
|
Config.assistantLabel = [Config.assistantLabel]
|
||||||
|
}
|
||||||
|
Config.assistantLabel = Config.assistantLabel || DefaultConfig.assistantLabel
|
||||||
|
Config.returnQQ = Config.returnQQ || DefaultConfig.returnQQ
|
||||||
|
Config.GroupList = Config.GroupList || DefaultConfig.GroupList
|
||||||
|
Config.UserList = Config.UserList || DefaultConfig.UserList
|
||||||
|
Config.enableBYM = Config.enableBYM ?? DefaultConfig.enableBYM
|
||||||
|
Config.bymPreset = Config.bymPreset || DefaultConfig.bymPreset
|
||||||
|
Config.bymFuckPrompt = Config.bymFuckPrompt || DefaultConfig.bymFuckPrompt
|
||||||
|
Config.blockWords = Config.blockWords || DefaultConfig.blockWords
|
||||||
|
Config.AutoToDownImg = Config.AutoToDownImg ?? DefaultConfig.AutoToDownImg
|
||||||
|
Config.debug = Config.debug ?? DefaultConfig.debug
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 复读 */
|
/** 复读 */
|
||||||
|
|
@ -417,11 +450,11 @@ export class bym extends plugin {
|
||||||
let finalMsg = await convertFaces(t, true, e)
|
let finalMsg = await convertFaces(t, true, e)
|
||||||
logger.info(JSON.stringify(finalMsg))
|
logger.info(JSON.stringify(finalMsg))
|
||||||
if (Math.floor(Math.random() * 100) < 10) {
|
if (Math.floor(Math.random() * 100) < 10) {
|
||||||
await this.reply(finalMsg, true, {
|
await e.reply(finalMsg, true, {
|
||||||
recallMsg: RecallMsg ? 10 : 0
|
recallMsg: RecallMsg ? 10 : 0
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
await this.reply(finalMsg, false, {
|
await e.reply(finalMsg, false, {
|
||||||
recallMsg: RecallMsg ? 10 : 0
|
recallMsg: RecallMsg ? 10 : 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,16 +16,20 @@
|
||||||
"eventsource": "^2.0.2",
|
"eventsource": "^2.0.2",
|
||||||
"eventsource-parser": "^1.0.0",
|
"eventsource-parser": "^1.0.0",
|
||||||
"fastify": "^4.18.0",
|
"fastify": "^4.18.0",
|
||||||
|
"file-type": "^19.6.0",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
|
"fs": "0.0.1-security",
|
||||||
"https-proxy-agent": "7.0.1",
|
"https-proxy-agent": "7.0.1",
|
||||||
"js-tiktoken": "^1.0.5",
|
"js-tiktoken": "^1.0.5",
|
||||||
"keyv": "^4.5.3",
|
"keyv": "^4.5.3",
|
||||||
"keyv-file": "^0.2.0",
|
"keyv-file": "^0.2.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"microsoft-cognitiveservices-speech-sdk": "1.32.0",
|
"microsoft-cognitiveservices-speech-sdk": "1.32.0",
|
||||||
|
"moment": "^2.30.1",
|
||||||
"node-fetch": "^3.3.1",
|
"node-fetch": "^3.3.1",
|
||||||
"openai": "^3.2.1",
|
"openai": "^3.2.1",
|
||||||
"p-timeout": "^6.1.2",
|
"p-timeout": "^6.1.2",
|
||||||
|
"path": "^0.12.7",
|
||||||
"quick-lru": "6.1.1",
|
"quick-lru": "6.1.1",
|
||||||
"random": "^4.1.0",
|
"random": "^4.1.0",
|
||||||
"undici": "^5.21.0",
|
"undici": "^5.21.0",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue