Skip to content

Commit e1b68d8

Browse files
committed
Merge branch 'master' into mamba-checkpoints-3
2 parents 9f996a7 + 136bda7 commit e1b68d8

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

tools/server/public/index.html.gz

177 Bytes
Binary file not shown.

tools/server/webui/src/lib/stores/chat.svelte.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,6 @@ class ChatStore {
550550
await this.updateConversationName(this.activeConversation.id, title);
551551
}
552552

553-
const allMessages = await DatabaseStore.getConversationMessages(this.activeConversation.id);
554553
const assistantMessage = await this.createAssistantMessage(userMessage.id);
555554

556555
if (!assistantMessage) {
@@ -560,15 +559,23 @@ class ChatStore {
560559
this.activeMessages.push(assistantMessage);
561560
// Don't update currNode until after streaming completes to maintain proper conversation path
562561

563-
await this.streamChatCompletion(allMessages, assistantMessage, undefined, (error: Error) => {
564-
if (error.name === 'ContextError' && userMessage) {
565-
const userMessageIndex = this.findMessageIndex(userMessage.id);
566-
if (userMessageIndex !== -1) {
567-
this.activeMessages.splice(userMessageIndex, 1);
568-
DatabaseStore.deleteMessage(userMessage.id).catch(console.error);
562+
const conversationContext = this.activeMessages.slice(0, -1);
563+
564+
await this.streamChatCompletion(
565+
conversationContext,
566+
assistantMessage,
567+
undefined,
568+
(error: Error) => {
569+
if (error.name === 'ContextError' && userMessage) {
570+
const userMessageIndex = this.findMessageIndex(userMessage.id);
571+
572+
if (userMessageIndex !== -1) {
573+
this.activeMessages.splice(userMessageIndex, 1);
574+
DatabaseStore.deleteMessage(userMessage.id).catch(console.error);
575+
}
569576
}
570577
}
571-
});
578+
);
572579
} catch (error) {
573580
if (this.isAbortError(error)) {
574581
this.isLoading = false;
@@ -810,7 +817,6 @@ class ChatStore {
810817
this.currentResponse = '';
811818

812819
try {
813-
const allMessages = await DatabaseStore.getConversationMessages(this.activeConversation.id);
814820
const assistantMessage = await this.createAssistantMessage();
815821

816822
if (!assistantMessage) {
@@ -821,7 +827,9 @@ class ChatStore {
821827
await DatabaseStore.updateCurrentNode(this.activeConversation.id, assistantMessage.id);
822828
this.activeConversation.currNode = assistantMessage.id;
823829

824-
await this.streamChatCompletion(allMessages, assistantMessage);
830+
const conversationContext = this.activeMessages.slice(0, -1);
831+
832+
await this.streamChatCompletion(conversationContext, assistantMessage);
825833
} catch (regenerateError) {
826834
console.error('Failed to regenerate response:', regenerateError);
827835
this.isLoading = false;

tools/server/webui/src/routes/+layout.svelte

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
let isNewChatMode = $derived(page.url.searchParams.get('new_chat') === 'true');
2626
let showSidebarByDefault = $derived(activeMessages().length > 0 || isLoading());
2727
let sidebarOpen = $state(false);
28+
let innerHeight = $state<number | undefined>();
2829
let chatSidebar:
2930
| { activateSearchMode?: () => void; editActiveConversation?: () => void }
3031
| undefined = $state();
@@ -140,8 +141,6 @@
140141
});
141142
</script>
142143

143-
<svelte:window onkeydown={handleKeydown} />
144-
145144
<ModeWatcher />
146145

147146
<Toaster richColors />
@@ -157,7 +156,7 @@
157156
/>
158157

159158
<Sidebar.Provider bind:open={sidebarOpen}>
160-
<div class="flex h-screen w-full">
159+
<div class="flex h-screen w-full" style:height="{innerHeight}px">
161160
<Sidebar.Root class="h-full">
162161
<ChatSidebar bind:this={chatSidebar} />
163162
</Sidebar.Root>
@@ -174,3 +173,5 @@
174173
</Sidebar.Inset>
175174
</div>
176175
</Sidebar.Provider>
176+
177+
<svelte:window onkeydown={handleKeydown} bind:innerHeight />

0 commit comments

Comments
 (0)