mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-10-28 08:31:25 +00:00
Fix missing messages on sibling navigation (#16408)
* 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
This commit is contained in:
committed by
GitHub
parent
2aaf0a2a20
commit
84c8e305e8
Binary file not shown.
@@ -860,15 +860,18 @@ class ChatStore {
|
|||||||
this.currentResponse = '';
|
this.currentResponse = '';
|
||||||
|
|
||||||
try {
|
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) {
|
if (!assistantMessage) {
|
||||||
throw new Error('Failed to create assistant message');
|
throw new Error('Failed to create assistant message');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.activeMessages.push(assistantMessage);
|
this.activeMessages.push(assistantMessage);
|
||||||
await DatabaseStore.updateCurrentNode(this.activeConversation.id, assistantMessage.id);
|
|
||||||
this.activeConversation.currNode = assistantMessage.id;
|
|
||||||
|
|
||||||
const conversationContext = this.activeMessages.slice(0, -1);
|
const conversationContext = this.activeMessages.slice(0, -1);
|
||||||
|
|
||||||
@@ -1124,8 +1127,10 @@ class ChatStore {
|
|||||||
(m) => m.role === 'user' && m.parent === rootMessage?.id
|
(m) => m.role === 'user' && m.parent === rootMessage?.id
|
||||||
);
|
);
|
||||||
|
|
||||||
await DatabaseStore.updateCurrentNode(this.activeConversation.id, siblingId);
|
const currentLeafNodeId = findLeafNode(allMessages, siblingId);
|
||||||
this.activeConversation.currNode = siblingId;
|
|
||||||
|
await DatabaseStore.updateCurrentNode(this.activeConversation.id, currentLeafNodeId);
|
||||||
|
this.activeConversation.currNode = currentLeafNodeId;
|
||||||
await this.refreshActiveMessages();
|
await this.refreshActiveMessages();
|
||||||
|
|
||||||
// Only show title dialog if we're navigating between different first user message siblings
|
// Only show title dialog if we're navigating between different first user message siblings
|
||||||
|
|||||||
Reference in New Issue
Block a user