fix: Sync streaming content to active messages
This commit is contained in:
parent
aff13cc085
commit
fcb7d1f899
|
|
@ -18,6 +18,7 @@
|
|||
chatStore,
|
||||
errorDialog,
|
||||
isLoading,
|
||||
isChatStreaming,
|
||||
isEditing,
|
||||
getAddFilesHandler
|
||||
} from '$lib/stores/chat.svelte';
|
||||
|
|
@ -75,7 +76,7 @@
|
|||
let isServerLoading = $derived(serverLoading());
|
||||
let hasPropsError = $derived(!!serverError());
|
||||
|
||||
let isCurrentConversationLoading = $derived(isLoading());
|
||||
let isCurrentConversationLoading = $derived(isLoading() || isChatStreaming());
|
||||
|
||||
let isRouter = $derived(isRouterMode());
|
||||
|
||||
|
|
|
|||
|
|
@ -106,8 +106,15 @@ class ChatStore {
|
|||
this.isLoading = this.chatLoadingStates.get(convId) || false;
|
||||
const s = this.chatStreamingStates.get(convId);
|
||||
this.currentResponse = s?.response || '';
|
||||
if (s?.response && s?.messageId && this.messageUpdateCallback)
|
||||
this.messageUpdateCallback(s.messageId, { content: s.response });
|
||||
this.isStreamingActive = s !== undefined;
|
||||
this.setActiveProcessingConversation(convId);
|
||||
// Sync streaming content to activeMessages so UI displays current content
|
||||
if (s?.response && s?.messageId) {
|
||||
const idx = conversationsStore.findMessageIndex(s.messageId);
|
||||
if (idx !== -1) {
|
||||
conversationsStore.updateMessageAtIndex(idx, { content: s.response });
|
||||
}
|
||||
}
|
||||
}
|
||||
registerMessageUpdateCallback(
|
||||
callback: (messageId: string, updates: Partial<DatabaseMessage>) => void
|
||||
|
|
|
|||
Loading…
Reference in New Issue