Skip to content

Commit 2500c94

Browse files
Fix: missing edit icon for prompts (#4344)
consolidated duplicate handler to fix prompt icon behavior Co-authored-by: Timothy Carambat <[email protected]>
1 parent e31465a commit 2500c94

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

frontend/src/utils/chat/index.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,11 @@ export default function handleChat(
103103
chatId,
104104
metrics,
105105
};
106-
setLoadingResponse(false);
106+
107+
_chatHistory[chatIdx - 1] = { ..._chatHistory[chatIdx - 1], chatId }; // update prompt with chatID
108+
107109
emitAssistantMessageCompleteEvent(chatId);
110+
setLoadingResponse(false);
108111
} else {
109112
updatedHistory = {
110113
...existingHistory,
@@ -136,15 +139,6 @@ export default function handleChat(
136139
setChatHistory([..._chatHistory]);
137140
} else if (type === "agentInitWebsocketConnection") {
138141
setWebsocket(chatResult.websocketUUID);
139-
} else if (type === "finalizeResponseStream") {
140-
const chatIdx = _chatHistory.findIndex((chat) => chat.uuid === uuid);
141-
if (chatIdx !== -1) {
142-
_chatHistory[chatIdx - 1] = { ..._chatHistory[chatIdx - 1], chatId }; // update prompt with chatID
143-
_chatHistory[chatIdx] = { ..._chatHistory[chatIdx], chatId }; // update response with chatID
144-
}
145-
146-
setChatHistory([..._chatHistory]);
147-
setLoadingResponse(false);
148142
} else if (type === "stopGeneration") {
149143
const chatIdx = _chatHistory.length - 1;
150144
const existingHistory = { ..._chatHistory[chatIdx] };

0 commit comments

Comments
 (0)