]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
Fix missing messages on sibling navigation (#16408)
authorAleksander Grygier <redacted>
Fri, 3 Oct 2025 10:51:40 +0000 (12:51 +0200)
committerGitHub <redacted>
Fri, 3 Oct 2025 10:51:40 +0000 (12:51 +0200)
* fix: resolve message disappearing issue when navigating between regenerated siblings by using current leaf nodes instead of cached sibling IDs

* chore: update webui build output

* chore: update webui build output

tools/server/public/index.html.gz
tools/server/webui/src/lib/stores/chat.svelte.ts

index 03eba07ff8776f8fa54576184d8965b5ed6c910f..2801319c98d7086e111df9a21fa1790ad90d6d4c 100644 (file)
Binary files a/tools/server/public/index.html.gz and b/tools/server/public/index.html.gz differ
index e7f59d0117d0889471bb3757811f5515e4311f21..3f9226efeb3b4f9fe0e08dbf9970c43a9bb94cb8 100644 (file)
@@ -860,15 +860,18 @@ class ChatStore {
                        this.currentResponse = '';
 
                        try {
-                               const assistantMessage = await this.createAssistantMessage();
+                               const parentMessageId =
+                                       this.activeMessages.length > 0
+                                               ? this.activeMessages[this.activeMessages.length - 1].id
+                                               : null;
+
+                               const assistantMessage = await this.createAssistantMessage(parentMessageId);
 
                                if (!assistantMessage) {
                                        throw new Error('Failed to create assistant message');
                                }
 
                                this.activeMessages.push(assistantMessage);
-                               await DatabaseStore.updateCurrentNode(this.activeConversation.id, assistantMessage.id);
-                               this.activeConversation.currNode = assistantMessage.id;
 
                                const conversationContext = this.activeMessages.slice(0, -1);
 
@@ -1124,8 +1127,10 @@ class ChatStore {
                        (m) => m.role === 'user' && m.parent === rootMessage?.id
                );
 
-               await DatabaseStore.updateCurrentNode(this.activeConversation.id, siblingId);
-               this.activeConversation.currNode = siblingId;
+               const currentLeafNodeId = findLeafNode(allMessages, siblingId);
+
+               await DatabaseStore.updateCurrentNode(this.activeConversation.id, currentLeafNodeId);
+               this.activeConversation.currNode = currentLeafNodeId;
                await this.refreshActiveMessages();
 
                // Only show title dialog if we're navigating between different first user message siblings