fix: 使用终态答案校正流式输出

- DONE 事件携带后端汇总的完整最终正文

- 前端完成时替换可能受损的流式文本

- 补充文件 URL 终态校正回归测试
This commit is contained in:
2026-07-23 19:49:45 +08:00
parent 417e846cbd
commit 41545fcef0
4 changed files with 65 additions and 3 deletions

View File

@@ -229,8 +229,14 @@ public class AgentRunServiceDraftAndHitlTest {
Assert.assertEquals("先分析", reasoning.toString());
Assert.assertEquals("\n最终回答", content.toString());
Assert.assertEquals("\n最终回答", answer.toString());
Assert.assertTrue(emitter.envelopes.stream().anyMatch(envelope ->
envelope.getDomain() == ChatDomain.SYSTEM && envelope.getType() == ChatType.DONE));
ChatEnvelope<?> done = emitter.envelopes.stream()
.filter(envelope -> envelope.getDomain() == ChatDomain.SYSTEM
&& envelope.getType() == ChatType.DONE)
.findFirst()
.orElseThrow();
@SuppressWarnings("unchecked")
Map<String, Object> donePayload = (Map<String, Object>) done.getPayload();
Assert.assertEquals("\n最终回答", donePayload.get("finalText"));
}
/**