fix: Sync streaming content to active messages
This commit is contained in:
parent
fc2dfc1170
commit
6b58e32eaa
|
|
@ -106,8 +106,15 @@ class ChatStore {
|
||||||
this.isLoading = this.chatLoadingStates.get(convId) || false;
|
this.isLoading = this.chatLoadingStates.get(convId) || false;
|
||||||
const s = this.chatStreamingStates.get(convId);
|
const s = this.chatStreamingStates.get(convId);
|
||||||
this.currentResponse = s?.response || '';
|
this.currentResponse = s?.response || '';
|
||||||
if (s?.response && s?.messageId && this.messageUpdateCallback)
|
this.isStreamingActive = s !== undefined;
|
||||||
this.messageUpdateCallback(s.messageId, { content: s.response });
|
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(
|
registerMessageUpdateCallback(
|
||||||
callback: (messageId: string, updates: Partial<DatabaseMessage>) => void
|
callback: (messageId: string, updates: Partial<DatabaseMessage>) => void
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue