From bb411ab77fafcf253ba7ed1b5357d7b2bf95dada Mon Sep 17 00:00:00 2001 From: 17ColinMiPerry <17colinmiperry@gmail.com> Date: Sun, 31 Aug 2025 01:04:09 -0700 Subject: [PATCH] consolidated duplicate handler to fix prompt icon behavior --- frontend/src/utils/chat/index.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/frontend/src/utils/chat/index.js b/frontend/src/utils/chat/index.js index 27ea28eb5f9..bfabcbeacbf 100644 --- a/frontend/src/utils/chat/index.js +++ b/frontend/src/utils/chat/index.js @@ -103,8 +103,11 @@ export default function handleChat( chatId, metrics, }; - setLoadingResponse(false); + + _chatHistory[chatIdx - 1] = { ..._chatHistory[chatIdx - 1], chatId }; // update prompt with chatID + emitAssistantMessageCompleteEvent(chatId); + setLoadingResponse(false); } else { updatedHistory = { ...existingHistory, @@ -136,15 +139,6 @@ export default function handleChat( setChatHistory([..._chatHistory]); } else if (type === "agentInitWebsocketConnection") { setWebsocket(chatResult.websocketUUID); - } else if (type === "finalizeResponseStream") { - const chatIdx = _chatHistory.findIndex((chat) => chat.uuid === uuid); - if (chatIdx !== -1) { - _chatHistory[chatIdx - 1] = { ..._chatHistory[chatIdx - 1], chatId }; // update prompt with chatID - _chatHistory[chatIdx] = { ..._chatHistory[chatIdx], chatId }; // update response with chatID - } - - setChatHistory([..._chatHistory]); - setLoadingResponse(false); } else if (type === "stopGeneration") { const chatIdx = _chatHistory.length - 1; const existingHistory = { ..._chatHistory[chatIdx] };