fix: stream real agent reasoning

This commit is contained in:
boos
2026-06-06 20:26:31 +08:00
parent 44dc89a0dd
commit 6cd0a8caca
2 changed files with 128 additions and 27 deletions
+5 -11
View File
@@ -1349,22 +1349,16 @@ export default function ComfyUIAgent() {
const renderReasoning = (message: AgentMessage | StreamAccumulator, isStreaming = false) => {
const processed = processThinkTags(message.content || '', message.reasoningContent || '');
const hasReasoning = processed.reasoningContent.trim().length > 0;
if (!hasReasoning && !isStreaming) return null;
if (!hasReasoning) return null;
return (
<details open={isStreaming} style={reasoningBoxStyle}>
<summary style={reasoningSummaryStyle}>
思考过程
</summary>
{hasReasoning ? (
<div
style={reasoningContentStyle}
dangerouslySetInnerHTML={{ __html: renderMarkdown(processed.reasoningContent) }}
/>
) : (
<div style={reasoningContentStyle}>
正在分析你的需求、拆解角色、场景、镜头与后续工作流步骤...
</div>
)}
<div
style={reasoningContentStyle}
dangerouslySetInnerHTML={{ __html: renderMarkdown(processed.reasoningContent) }}
/>
</details>
);
};