Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified tools/server/public/index.html.gz
Binary file not shown.
15 changes: 10 additions & 5 deletions tools/server/webui/src/lib/stores/chat.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down