fix: 系统提示词卡片包含 SOUL.md 内容

state.set('_lastSystemPrompt') 改为从 messages 中拼接所有 system 消息,
确保 SOUL.md 也出现在 AI 回复顶部的折叠卡片中。
This commit is contained in:
thzxx
2026-06-04 22:04:54 +08:00
parent 846fa0f111
commit 968350861d
+6 -2
View File
@@ -493,8 +493,12 @@ export async function runAgentLoop(
messages.push({ role: 'system', content: fullSystemPrompt }); messages.push({ role: 'system', content: fullSystemPrompt });
// 将完整系统提示词存入 state,供 input-area 在助理消息上展示 // 将完整系统提示词存入 state(包含 SOUL.md + fullSystemPrompt
state.set('_lastSystemPrompt', 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) { for (const msg of historyMessages) {