θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions frontend/src/utils/chat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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] };
Expand Down