fix(agent): 修复WeKnora对话完前端未显示结束标记问题

fix(agent): 修复流式回答think内容与answer混淆问题
This commit is contained in:
bingxiang.cheng
2026-05-03 23:09:58 +08:00
committed by lyingbug
parent 7adf88766a
commit a232b12ff0
5 changed files with 80 additions and 13 deletions
@@ -865,6 +865,12 @@ const isConversationDone = computed(() => {
console.log('[Collapse] Found stop event, conversation done');
return true;
}
const completeEvent = stream.find((e: any) => e.type === 'agent_complete');
if (completeEvent) {
console.log('[Collapse] Found complete event, conversation done');
return true;
}
// Check for answer event with done=true
const answerEvents = stream.filter((e: any) => e.type === 'answer');
@@ -3435,4 +3441,4 @@ html[theme-mode="dark"] .tree-root-title img {
filter: invert(1);
opacity: 0.55;
}
</style>
</style>
+7 -4
View File
@@ -1095,12 +1095,15 @@ const handleAgentChunk = (data) => {
console.log('[Agent] Complete event received');
loading.value = false;
isReplying.value = false;
message.is_completed = true;
fullContent.value = '';
currentAssistantMessageId.value = '';
// 将 total_duration_ms 存入事件流供 AgentStreamDisplay 使用
if (data.data?.total_duration_ms && message.agentEventStream) {
if (message.agentEventStream) {
message.agentEventStream.push({
type: 'agent_complete',
total_duration_ms: data.data.total_duration_ms,
total_steps: data.data.total_steps,
total_duration_ms: data.data?.total_duration_ms || 0,
total_steps: data.data?.total_steps || 0,
});
}
break;
@@ -1538,4 +1541,4 @@ onBeforeRouteUpdate((to, from, next) => {
color: var(--td-success-color);
}
}
</style>
</style>