From ec2b44494fbf67d40a4e24b6aff55be851eb7db3 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Wed, 13 May 2026 13:34:44 +0800 Subject: [PATCH] fix(frontend): show reasoning_content in historical agent steps Tool-calling rounds emit reasoning into the OpenAI-protocol reasoning_content field rather than visible content, so AgentStep.Thought is often empty in DB. The history reconstructor only read step.thought, which made the historical step card silent for those rounds even though the user saw the reasoning live. Fall back to step.reasoning_content when step.thought is empty so reload mirrors the live experience. --- frontend/src/views/chat/index.vue | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/chat/index.vue b/frontend/src/views/chat/index.vue index 7858cd35d..7d241266f 100644 --- a/frontend/src/views/chat/index.vue +++ b/frontend/src/views/chat/index.vue @@ -322,12 +322,22 @@ const reconstructEventStreamFromSteps = (agentSteps, messageContent, isCompleted // Compute step timestamp (milliseconds) from step.timestamp if available const stepTimestamp = step.timestamp ? new Date(step.timestamp).getTime() : 0; - // Add thinking event if thought content exists - if (step.thought && step.thought.trim()) { + // Add thinking event if thought content exists. + // For tool-calling rounds, providers like MiMo / DeepSeek thinking-mode + // emit reasoning into the OpenAI-protocol `reasoning_content` field + // rather than visible `content`, so step.thought is often empty even + // though the model did reason. Fall back to step.reasoning_content so + // the historical step card mirrors what the user saw live. + const thoughtText = (step.thought && step.thought.trim()) + ? step.thought + : (step.reasoning_content && step.reasoning_content.trim()) + ? step.reasoning_content + : ''; + if (thoughtText) { events.push({ type: 'thinking', event_id: `step-${step.iteration}-thought`, - content: step.thought, + content: thoughtText, done: true, thinking: false, timestamp: stepTimestamp || undefined,