Update useChatStreamMessage.ts

This commit is contained in:
Nate Kelley 2025-03-06 10:18:50 -07:00
parent 0fe011396d
commit 6c53cf5cb0
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 2 additions and 7 deletions

View File

@ -68,9 +68,7 @@ export const useChatStreamMessage = () => {
const completeChatCallback = useMemoizedFn((d: BusterChat) => {
const { iChat, iChatMessages } = updateChatToIChat(d, false);
chatRef.current = create(chatRef.current, (draft) => {
draft[iChat.id] = iChat;
});
chatRef.current[iChat.id] = iChat;
normalizeChatMessage(iChatMessages);
onUpdateChat(iChat);
});
@ -84,9 +82,7 @@ export const useChatStreamMessage = () => {
const initializeNewChatCallback = useMemoizedFn((d: BusterChat) => {
const { iChat, iChatMessages } = updateChatToIChat(d, true);
chatRef.current = create(chatRef.current, (draft) => {
draft[iChat.id] = iChat;
});
chatRef.current[iChat.id] = iChat;
normalizeChatMessage(iChatMessages);
onUpdateChat(iChat);
onChangePage({
@ -99,7 +95,6 @@ export const useChatStreamMessage = () => {
({ prompt, messageId }: { prompt: string; messageId: string }) => {
const currentMessage = getChatMessage(messageId);
const currentRequestMessage = currentMessage?.request_message!;
onUpdateChatMessage({
id: messageId,
request_message: create(currentRequestMessage, (draft) => {