修复会话消息实时响应的时候未正确初始化状态

This commit is contained in:
xintaofei
2026-03-11 17:58:37 +08:00
parent e23bea9393
commit 05b96027f6

View File

@@ -674,15 +674,15 @@ export function adaptMessageTurn(
: undefined, : undefined,
}) })
} else { } else {
// For DB historical data, unmatched tools default to "completed" // For live streaming, unmatched tools are still running.
// since the conversation has already ended. "input-available" (Running) // For DB historical data, default to "completed" since the
// only makes sense for live streaming contexts. // conversation has already ended.
adaptedContent.push({ adaptedContent.push({
type: "tool-call", type: "tool-call",
toolCallId, toolCallId,
toolName: block.tool_name, toolName: block.tool_name,
input: block.input_preview, input: block.input_preview,
state: "output-available", state: isStreaming ? "input-available" : "output-available",
}) })
} }
} }