Description of the Bug
In frontend/src/components/chat/ChatPanel.tsx, when the streaming endpoint sends a thought event type, the message content is appended directly to the visible chat bubble:
if (event.type === "thought") {
setCurrentAnswer(prev => prev + `\n[thought] ${event.data}`);
}
When subsequent token events arrive (the actual answer), the thought text becomes permanently embedded within the visible response. The user sees something like:
[thought] The user is asking about the revenue figures from the Q3 report. I need to search the document for relevant data.
Based on the document, the Q3 revenue was $4.2 million...
This is confusing because:
- The thought process should be visually distinct from the final answer
- The
[thought] prefix looks like a debug artifact
- Thoughts can be lengthy (paragraphs of reasoning) and clutter the response
- There is no way for the user to hide or expand thoughts
Steps to Reproduce
- Start a chat session and ask a complex question
- The streaming response includes intermediate thought steps
- Observe that thoughts and the final answer are mixed together in the same text bubble
- The
[thought] prefix is displayed to the user as plain text
Expected Behavior
Thought events should be displayed separately from the answer, for example in:
- A collapsible "Show reasoning" section above the answer
- A separate UI element with a subtle style (smaller font, muted color)
- A separate pane or drawer
Affected File
frontend/src/components/chat/ChatPanel.tsx (lines ~329-336)
Suggested Fix
Store thoughts in a separate field/state and render them distinctly:
// Separate states
const [thoughts, setThoughts] = useState<string[]>([]);
const [currentAnswer, setCurrentAnswer] = useState("");
// Handler
if (event.type === "thought") {
setThoughts(prev => [...prev, event.data]);
} else if (event.type === "token") {
setCurrentAnswer(prev => prev + event.data);
}
Render thoughts in a collapsible section above the answer.
GSSoC '26
Description of the Bug
In
frontend/src/components/chat/ChatPanel.tsx, when the streaming endpoint sends athoughtevent type, the message content is appended directly to the visible chat bubble:When subsequent
tokenevents arrive (the actual answer), the thought text becomes permanently embedded within the visible response. The user sees something like:This is confusing because:
[thought]prefix looks like a debug artifactSteps to Reproduce
[thought]prefix is displayed to the user as plain textExpected Behavior
Thought events should be displayed separately from the answer, for example in:
Affected File
frontend/src/components/chat/ChatPanel.tsx(lines ~329-336)Suggested Fix
Store thoughts in a separate field/state and render them distinctly:
Render thoughts in a collapsible section above the answer.
GSSoC '26