From 0def08bb2e3b84f24164b29b5977f13af03e5606 Mon Sep 17 00:00:00 2001 From: shatfield4 Date: Wed, 15 Oct 2025 14:25:31 -0700 Subject: [PATCH] patch agent ui bug where text would show up in agent thoughts --- frontend/src/utils/chat/agent.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/frontend/src/utils/chat/agent.js b/frontend/src/utils/chat/agent.js index 2194b3e1d47..d51aced5743 100644 --- a/frontend/src/utils/chat/agent.js +++ b/frontend/src/utils/chat/agent.js @@ -78,6 +78,27 @@ export default function handleSocketResponse(socket, event, setChatHistory) { ]; } + // Handle textResponseChunk initialization as textResponse instead of statusResponse. + // Without this the first chunk creates a statusResponse (thought bubble) by falling through to the default case. + // Providers like Gemini send large chunks and can complete in a single chunk before the update logic can convert it. + // Other providers send many small chunks so the second chunk triggers the update logic to fix the type. + if (data.content.type === "textResponseChunk") { + return [ + ...prev.filter((msg) => !!msg.content), + { + uuid: data.content.uuid, + type: "textResponse", + content: data.content.content, + role: "assistant", + sources: [], + closed: true, + error: null, + animate: false, + pending: false, + }, + ]; + } + return [ ...prev.filter((msg) => !!msg.content), {