From 8698e9db98bad1b099236eec67fc543e03b0d66c Mon Sep 17 00:00:00 2001 From: Jerrypluay Date: Tue, 11 Nov 2025 13:07:52 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E7=9A=84=E9=A2=84=E8=AE=BE=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=A0=87=E8=AE=B0=E5=92=8C=E9=80=82=E9=85=8D=E5=99=A8=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ai.js | 10 ++++------ constants/ai/prompts.js | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/ai.js b/apps/ai.js index baca5a5..3fca793 100644 --- a/apps/ai.js +++ b/apps/ai.js @@ -95,8 +95,6 @@ async function index(e) { if (!userMessage || userMessage.length === 0) { return e.reply(segment.image(await Meme.getMeme(aiConfig.character, 'default'))); } - const adapter = await YunzaiUtils.getAdapter(e); - await Message.emojiLike(e, e.message_id, 128064, e.group_id, adapter); //👀 const result = await processMessage(userMessage, e, aiConfig); if (result && result.length > 0) { // TODO 优化流式输出 @@ -106,8 +104,6 @@ async function index(e) { logger.error(`[crystelf-ai] 处理消息失败: ${error.message}`); const adapter = await YunzaiUtils.getAdapter(e); await Message.emojiLike(e, e.message_id, 10060, e.group_id, adapter); - const config = await ConfigControl.get(); - const aiConfig = config?.ai; //return e.reply(segment.image(await Meme.getMeme(aiConfig.character, 'default'))); } } @@ -117,7 +113,7 @@ async function extractUserMessage(msg, nickname, e) { let text = []; let at = []; e.message.forEach((message) => { - //logger.info(message); + logger.info(message); if (message.type === 'text' && (message.text !== '' || message.text !== '\n')) { text.push(message.text); } else if (message.type === 'at') { @@ -235,7 +231,7 @@ async function handleMixMode(userMessage, e, aiConfig) { ]; let resMessage = { type: 'message', - data: matchResult.text + ' [词库预设消息]', + data: matchResult.text, at: false, quote: false, recall: 0, @@ -269,6 +265,8 @@ async function callAiForResponse(userMessage, e, aiConfig) { await Message.emojiLike(e, e.message_id, 128166, e.group_id, adapter); return null; } + const adapter = await YunzaiUtils.getAdapter(e); + await Message.emojiLike(e, e.message_id, 128064, e.group_id, adapter); //👀 //搜索相关记忆 const memories = await MemorySystem.searchMemories(e.user_id, e.msg || '', 5); logger.info(`[crystelf-ai] ${memories}`); diff --git a/constants/ai/prompts.js b/constants/ai/prompts.js index c898bc1..aad24ae 100644 --- a/constants/ai/prompts.js +++ b/constants/ai/prompts.js @@ -63,7 +63,6 @@ export const RESPONSE_FORMAT = `请严格按照以下格式按顺序返回你的 关于上下文: 1. 你会获得最近的上下文消息,请根据语境回复,可能会有不同的人发送消息,请以昵称和qq号区分 -2. 如果上下文消息中你的回复标记为[词库预设消息],那么代表这条消息没有经过你处理就通过关键词匹配发送给了用户,请核查这种消息(只需要核查最近的一条),如果回复不符合语境,那么在有需要的情况下跟用户说明(例如说明上一条消息是预设的等等) 示例: [