mirror of
https://github.com/Jerryplusy/crystelf-plugin.git
synced 2025-12-05 07:31:56 +00:00
Compare commits
2 Commits
875ca65ed9
...
894dba0aa0
| Author | SHA1 | Date | |
|---|---|---|---|
| 894dba0aa0 | |||
| f25440698a |
11
README.md
11
README.md
@ -115,8 +115,8 @@
|
||||
- [X] 支持获取引用消息,使用seq标记
|
||||
- [X] 支持群聊上下文消息
|
||||
- [ ] 支持调用更多工具
|
||||
- [ ] 获取引用消息
|
||||
- [ ] 适配多模态模型,查看图片等
|
||||
- [X] 获取引用消息
|
||||
- [X] 适配多模态模型,查看图片等
|
||||
- [ ] 支持联网搜索
|
||||
- [ ] 支持生成图片
|
||||
- [ ] 支持渲染数学公式
|
||||
@ -158,7 +158,8 @@
|
||||
"faceReply": true,
|
||||
"ai": true,
|
||||
"blackWords": true,
|
||||
"music": true
|
||||
"music": true,
|
||||
"auth": true
|
||||
}
|
||||
```
|
||||
</details>
|
||||
@ -259,6 +260,10 @@
|
||||
"apiKey": "", //你的api密钥
|
||||
"?modelType": "模型名称,请根据baseApi填写的服务商的对应的模型",
|
||||
"modelType": "deepseek-ai/DeepSeek-V3.2-Exp",
|
||||
"?multimodalEnabled": "是否启用多模态模型模式,启用后将忽略文本模型",//开启多模态模式后,将默认使用多模态模型回复
|
||||
"multimodalEnabled": false,//多模态模式可以处理视频,图片等
|
||||
"?multimodalModel": "多模态模型名称",
|
||||
"multimodalModel": "Qwen/Qwen2.5-VL-72B-Instruct",
|
||||
"?temperature": "聊天温度,可选0-2.0,温度越高创造性越高",
|
||||
"temperature": 1.2,
|
||||
"?concurrency": "最大同时聊天群数,一个群最多一个人聊天",
|
||||
|
||||
@ -76,7 +76,6 @@ Bot.on('message.group', async (e) => {
|
||||
|
||||
async function index(e) {
|
||||
try {
|
||||
//logger.info('111')
|
||||
const config = await ConfigControl.get();
|
||||
const aiConfig = config?.ai;
|
||||
if (!config?.config?.ai) {
|
||||
|
||||
@ -13,7 +13,6 @@ export class FaceReply extends plugin {
|
||||
}
|
||||
|
||||
async accept(e) {
|
||||
if (!ConfigControl.get('config')?.faceReply) return;
|
||||
if (!e.message_id || e.message.length === 0) return;
|
||||
let face = [];
|
||||
e.message.forEach((m) => {
|
||||
|
||||
@ -117,9 +117,6 @@ export default class FanqiePlugin extends plugin {
|
||||
* 解析网页链接中的 book_id
|
||||
*/
|
||||
async handleFanqieLink(e) {
|
||||
if (!ConfigControl.get()?.config?.fanqie) {
|
||||
return;
|
||||
}
|
||||
const message = e.msg.trim();
|
||||
let bookId = null;
|
||||
|
||||
@ -140,9 +137,6 @@ export default class FanqiePlugin extends plugin {
|
||||
* 使用 #fq下载 命令下载
|
||||
*/
|
||||
async downloadByBookId(e) {
|
||||
if (!ConfigControl.get()?.config?.fanqie) {
|
||||
return;
|
||||
}
|
||||
const bookId = e.msg.replace(/^#?fq下载/, '').trim();
|
||||
return this.downloadFanqieBook(e, bookId);
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ export class CrystelfMusic extends plugin {
|
||||
super({
|
||||
name: 'crystelf-music',
|
||||
dsc: '音乐点歌插件',
|
||||
event: 'message.group',
|
||||
event: 'message',
|
||||
priority: -1000,
|
||||
rule: [
|
||||
{
|
||||
|
||||
@ -16,5 +16,6 @@
|
||||
"faceReply": true,
|
||||
"ai": true,
|
||||
"blackWords": true,
|
||||
"music": true
|
||||
"music": true,
|
||||
"auth": true
|
||||
}
|
||||
|
||||
53
index.js
53
index.js
@ -23,22 +23,65 @@ if(appConfig.autoUpdate) {
|
||||
|
||||
const appPath = Path.apps;
|
||||
const jsFiles = await fc.readDirRecursive(appPath, 'js');
|
||||
const enabledApps = [];
|
||||
const disabledApps = [];
|
||||
|
||||
let ret = jsFiles.map((file) => {
|
||||
for (const file of jsFiles) {
|
||||
const name = file.replace('.js', '');
|
||||
const configKey = getConfigKey(name);
|
||||
if (appConfig[configKey] === false) {
|
||||
disabledApps.push(name);
|
||||
logger.info(`[crystelf-plugin] 插件 ${name} 已禁用,跳过加载`);
|
||||
} else {
|
||||
enabledApps.push(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (disabledApps.length > 0) {
|
||||
logger.info(`[crystelf-plugin] 已跳过 ${disabledApps.length} 个禁用的插件: ${disabledApps.join(', ')}`);
|
||||
}
|
||||
|
||||
let ret = enabledApps.map((file) => {
|
||||
return import(`./apps/${file}`);
|
||||
});
|
||||
|
||||
ret = await Promise.allSettled(ret);
|
||||
|
||||
let apps = {};
|
||||
for (let i in jsFiles) {
|
||||
let name = jsFiles[i].replace('.js', '');
|
||||
|
||||
for (let i in enabledApps) {
|
||||
let name = enabledApps[i].replace('.js', '');
|
||||
if (ret[i].status !== 'fulfilled') {
|
||||
logger.error(name, ret[i].reason);
|
||||
logger.error(`[crystelf-plugin] 插件 ${name} 加载失败:`, ret[i].reason);
|
||||
continue;
|
||||
}
|
||||
apps[name] = ret[i].value[Object.keys(ret[i].value)[0]];
|
||||
}
|
||||
logger.info(`[crystelf-plugin] 成功加载 ${Object.keys(apps).length} 个插件`);
|
||||
|
||||
export { apps };
|
||||
|
||||
/**
|
||||
* 将插件文件名映射到配置键名
|
||||
* @param {string} fileName
|
||||
* @returns {string}
|
||||
*/
|
||||
function getConfigKey(fileName) {
|
||||
const keyMap = {
|
||||
'60s': '60s',
|
||||
'ai': 'ai',
|
||||
'auth': 'auth',
|
||||
'auth-set': 'auth',
|
||||
'face-reply': 'faceReply',
|
||||
'face-reply-message': 'faceReply',
|
||||
'fanqie': 'fanqie',
|
||||
'help': 'help',
|
||||
'music': 'music',
|
||||
'poke': 'poke',
|
||||
'rssPush': 'rss',
|
||||
'welcome': 'welcome',
|
||||
'welcome-set': 'welcome',
|
||||
'zwa': 'zwa'
|
||||
};
|
||||
|
||||
return keyMap[fileName] || fileName;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user