Skip to content

Commit 151f97d

Browse files
Patch agent thoughts UI bug (#4549)
patch agent ui bug where text would show up in agent thoughts Co-authored-by: Timothy Carambat <[email protected]>
1 parent d361968 commit 151f97d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

frontend/src/utils/chat/agent.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,27 @@ export default function handleSocketResponse(socket, event, setChatHistory) {
7878
];
7979
}
8080

81+
// Handle textResponseChunk initialization as textResponse instead of statusResponse.
82+
// Without this the first chunk creates a statusResponse (thought bubble) by falling through to the default case.
83+
// Providers like Gemini send large chunks and can complete in a single chunk before the update logic can convert it.
84+
// Other providers send many small chunks so the second chunk triggers the update logic to fix the type.
85+
if (data.content.type === "textResponseChunk") {
86+
return [
87+
...prev.filter((msg) => !!msg.content),
88+
{
89+
uuid: data.content.uuid,
90+
type: "textResponse",
91+
content: data.content.content,
92+
role: "assistant",
93+
sources: [],
94+
closed: true,
95+
error: null,
96+
animate: false,
97+
pending: false,
98+
},
99+
];
100+
}
101+
81102
return [
82103
...prev.filter((msg) => !!msg.content),
83104
{

0 commit comments

Comments
 (0)