Update useChatStreamMessage.ts

This commit is contained in:
Nate Kelley 2025-03-05 16:22:45 -07:00
parent 5b38037419
commit d7430f1594
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 12 additions and 9 deletions

View File

@ -219,15 +219,18 @@ export const useChatStreamMessage = () => {
reasoning.message_chunk !== null || reasoning.message_chunk !== undefined;
initializeOrUpdateMessage(chat_id, message_id, (draft) => {
if (!draft[chat_id]?.messages?.[message_id]?.reasoning_messages?.[reasoningMessageId])
return;
const messageText = draft[chat_id].messages[message_id].reasoning_messages[
reasoningMessageId
] as BusterChatMessageReasoning_text;
Object.assign(messageText, existingReasoningMessageText);
messageText.message = isStreaming
const reasoningMessage =
draft[chat_id]?.messages?.[message_id]?.reasoning_messages?.[reasoningMessageId];
if (!reasoningMessage) return;
const messageText = reasoningMessage as BusterChatMessageReasoning_text;
Object.assign(messageText, {
...existingReasoningMessageText,
...reasoning,
message: isStreaming
? (existingReasoningMessageText?.message || '') + (reasoning.message_chunk || '')
: reasoning.message;
: reasoning.message
});
});
break;