refactor(atom-extraction): remove assistant name hint and enforce role extraction from text

This commit is contained in:
2026-02-13 14:30:56 +08:00
parent 4214cc89a4
commit 9ba120364c

View File

@@ -61,7 +61,7 @@ const SYSTEM_PROMPT = `你是场景摘要器。从一轮对话中提取1-2个场
输入格式: 输入格式:
<round> <round>
<user name="用户名">...</user> <user name="用户名">...</user>
<assistant name="角色名">...</assistant> <assistant>...</assistant>
</round> </round>
只输出严格JSON 只输出严格JSON
@@ -83,6 +83,7 @@ const SYSTEM_PROMPT = `你是场景摘要器。从一轮对话中提取1-2个场
## who ## who
- 参与互动的角色正式名称,不用代词或别称 - 参与互动的角色正式名称,不用代词或别称
- 只从正文内容中识别角色名,不要把标签名(如 user、assistant当作角色
## edges关系三元组 ## edges关系三元组
- s=施事方 t=受事方 r=互动行为10-15字 - s=施事方 t=受事方 r=互动行为10-15字
@@ -218,7 +219,6 @@ async function extractAtomsForRoundWithRetry(userMessage, aiMessage, aiFloor, op
const parts = []; const parts = [];
const userName = userMessage?.name || '用户'; const userName = userMessage?.name || '用户';
const aiName = aiMessage.name || '角色';
if (userMessage?.mes?.trim()) { if (userMessage?.mes?.trim()) {
const userText = filterText(userMessage.mes); const userText = filterText(userMessage.mes);
@@ -226,7 +226,7 @@ async function extractAtomsForRoundWithRetry(userMessage, aiMessage, aiFloor, op
} }
const aiText = filterText(aiMessage.mes); const aiText = filterText(aiMessage.mes);
parts.push(`<assistant name="${aiName}">\n${aiText}\n</assistant>`); parts.push(`<assistant>\n${aiText}\n</assistant>`);
const input = `<round>\n${parts.join('\n')}\n</round>`; const input = `<round>\n${parts.join('\n')}\n</round>`;