From 968350861d7a14d9d64c2c69717e9ba832763f33 Mon Sep 17 00:00:00 2001 From: thzxx Date: Thu, 4 Jun 2026 22:04:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=B3=BB=E7=BB=9F=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E8=AF=8D=E5=8D=A1=E7=89=87=E5=8C=85=E5=90=AB=20SOUL.md=20?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit state.set('_lastSystemPrompt') 改为从 messages 中拼接所有 system 消息, 确保 SOUL.md 也出现在 AI 回复顶部的折叠卡片中。 --- src/renderer/services/agent-engine.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/renderer/services/agent-engine.ts b/src/renderer/services/agent-engine.ts index 1326c55..c8e29af 100644 --- a/src/renderer/services/agent-engine.ts +++ b/src/renderer/services/agent-engine.ts @@ -493,8 +493,12 @@ export async function runAgentLoop( messages.push({ role: 'system', content: fullSystemPrompt }); - // 将完整系统提示词存入 state,供 input-area 在助理消息上展示 - state.set('_lastSystemPrompt', fullSystemPrompt); + // 将完整系统提示词存入 state(包含 SOUL.md + fullSystemPrompt) + const allSystemContent = messages + .filter(m => m.role === 'system') + .map(m => m.content) + .join('\n\n'); + state.set('_lastSystemPrompt', allSystemContent || fullSystemPrompt); // 添加历史消息 for (const msg of historyMessages) {