Fix: missing edit icon for prompts (#4344)
consolidated duplicate handler to fix prompt icon behavior Co-authored-by: Timothy Carambat <rambat1010@gmail.com>
This commit is contained in:
parent
e31465a639
commit
2500c94b83
@ -103,8 +103,11 @@ export default function handleChat(
|
|||||||
chatId,
|
chatId,
|
||||||
metrics,
|
metrics,
|
||||||
};
|
};
|
||||||
setLoadingResponse(false);
|
|
||||||
|
_chatHistory[chatIdx - 1] = { ..._chatHistory[chatIdx - 1], chatId }; // update prompt with chatID
|
||||||
|
|
||||||
emitAssistantMessageCompleteEvent(chatId);
|
emitAssistantMessageCompleteEvent(chatId);
|
||||||
|
setLoadingResponse(false);
|
||||||
} else {
|
} else {
|
||||||
updatedHistory = {
|
updatedHistory = {
|
||||||
...existingHistory,
|
...existingHistory,
|
||||||
@ -136,15 +139,6 @@ export default function handleChat(
|
|||||||
setChatHistory([..._chatHistory]);
|
setChatHistory([..._chatHistory]);
|
||||||
} else if (type === "agentInitWebsocketConnection") {
|
} else if (type === "agentInitWebsocketConnection") {
|
||||||
setWebsocket(chatResult.websocketUUID);
|
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") {
|
} else if (type === "stopGeneration") {
|
||||||
const chatIdx = _chatHistory.length - 1;
|
const chatIdx = _chatHistory.length - 1;
|
||||||
const existingHistory = { ..._chatHistory[chatIdx] };
|
const existingHistory = { ..._chatHistory[chatIdx] };
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user