From 92bfe8087c50989fcb93c4b816c3972b287a5abb Mon Sep 17 00:00:00 2001 From: Jerrypluay Date: Sat, 18 Oct 2025 00:00:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=AE=8C=E5=96=84=E5=85=B3=E9=94=AE?= =?UTF-8?q?=E8=AF=8D=E5=8C=B9=E9=85=8D=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ai.js | 8 +++----- lib/ai/keywordMatcher.js | 2 ++ lib/core/words.js | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/ai.js b/apps/ai.js index d00854f..1478dd2 100644 --- a/apps/ai.js +++ b/apps/ai.js @@ -39,15 +39,13 @@ export class crystelfAI extends plugin { this.isInitialized = true; logger.info('[crystelf-ai] 初始化完成'); } catch (error) { - logger.err(`[crystelf-ai] 初始化失败: ${error.message}`); + logger.error(`[crystelf-ai] 初始化失败: ${error.message}`); } } async index(e) { try { - if (!this.isInitialized) { - await this.init(); - } + //logger.info('111') const config = await ConfigControl.get(); const aiConfig = config?.ai; if (!config?.config?.ai) { @@ -102,7 +100,7 @@ export class crystelfAI extends plugin { */ async processMessage(userMessage, e, aiConfig) { const mode = aiConfig?.mode || 'mix'; - + logger.info(`[crystelf-ai] 群${e.group_id} 用户${e.user_id}使用${mode}进行回复..`) switch (mode) { case 'keyword': return await this.handleKeywordMode(userMessage, e); diff --git a/lib/ai/keywordMatcher.js b/lib/ai/keywordMatcher.js index 8fa1685..e3e1796 100644 --- a/lib/ai/keywordMatcher.js +++ b/lib/ai/keywordMatcher.js @@ -81,10 +81,12 @@ class KeywordMatcher { */ async matchKeywords(message, type = 'ai') { if (!message || !this.isInitialized) { + logger.warn('[crystelf-ai] 关键词回复出现问题,请检查消息或联系帮助..') return null; } try { const keywords = await this.getKeywordsList(type); + //logger.info(keywords); if (!keywords || keywords.length === 0) { return null; } diff --git a/lib/core/words.js b/lib/core/words.js index 81f2ce2..b23b77e 100644 --- a/lib/core/words.js +++ b/lib/core/words.js @@ -10,18 +10,18 @@ const Words = { async getWordsList(type){ const coreConfig = await ConfigControl.get()?.coreConfig; const coreUrl = coreConfig.coreUrl; - return await axios.post(`${coreUrl}/api/words/list`, { + return await (await axios.post(`${coreUrl}/api/words/list`, { type: type, - })?.data?.data; + }))?.data?.data; }, async getWord(type,name){ const coreConfig = await ConfigControl.get()?.coreConfig; const coreUrl = coreConfig.coreUrl; - return await axios.post(`${coreUrl}/api/words/getText`, { + return await (await axios.post(`${coreUrl}/api/words/getText`, { type: type, - id:name - })?.data?.data; + id: name + }))?.data?.data; } }