Merge branch 'upstream' into concedo_experimental

# Conflicts:
#	.devops/intel.Dockerfile
#	.devops/rocm.Dockerfile
#	.github/workflows/build.yml
#	.github/workflows/release.yml
#	CODEOWNERS
#	ci/run.sh
#	docs/backend/SYCL.md
#	ggml/CMakeLists.txt
#	ggml/src/ggml-cuda/fattn-wmma-f16.cu
#	ggml/src/ggml-hip/CMakeLists.txt
#	ggml/src/ggml-musa/CMakeLists.txt
#	ggml/src/ggml-webgpu/ggml-webgpu.cpp
#	ggml/src/ggml-webgpu/wgsl-shaders/rms_norm.wgsl
#	tests/test-backend-ops.cpp
#	tests/test-barrier.cpp
#	tests/test-chat.cpp
This commit is contained in:
Concedo
2025-10-03 16:44:33 +08:00
37 changed files with 1128 additions and 66 deletions
Binary file not shown.
@@ -550,7 +550,6 @@ class ChatStore {
await this.updateConversationName(this.activeConversation.id, title);
}
const allMessages = await DatabaseStore.getConversationMessages(this.activeConversation.id);
const assistantMessage = await this.createAssistantMessage(userMessage.id);
if (!assistantMessage) {
@@ -560,15 +559,23 @@ class ChatStore {
this.activeMessages.push(assistantMessage);
// Don't update currNode until after streaming completes to maintain proper conversation path
await this.streamChatCompletion(allMessages, assistantMessage, undefined, (error: Error) => {
if (error.name === 'ContextError' && userMessage) {
const userMessageIndex = this.findMessageIndex(userMessage.id);
if (userMessageIndex !== -1) {
this.activeMessages.splice(userMessageIndex, 1);
DatabaseStore.deleteMessage(userMessage.id).catch(console.error);
const conversationContext = this.activeMessages.slice(0, -1);
await this.streamChatCompletion(
conversationContext,
assistantMessage,
undefined,
(error: Error) => {
if (error.name === 'ContextError' && userMessage) {
const userMessageIndex = this.findMessageIndex(userMessage.id);
if (userMessageIndex !== -1) {
this.activeMessages.splice(userMessageIndex, 1);
DatabaseStore.deleteMessage(userMessage.id).catch(console.error);
}
}
}
});
);
} catch (error) {
if (this.isAbortError(error)) {
this.isLoading = false;
@@ -810,7 +817,6 @@ class ChatStore {
this.currentResponse = '';
try {
const allMessages = await DatabaseStore.getConversationMessages(this.activeConversation.id);
const assistantMessage = await this.createAssistantMessage();
if (!assistantMessage) {
@@ -821,7 +827,9 @@ class ChatStore {
await DatabaseStore.updateCurrentNode(this.activeConversation.id, assistantMessage.id);
this.activeConversation.currNode = assistantMessage.id;
await this.streamChatCompletion(allMessages, assistantMessage);
const conversationContext = this.activeMessages.slice(0, -1);
await this.streamChatCompletion(conversationContext, assistantMessage);
} catch (regenerateError) {
console.error('Failed to regenerate response:', regenerateError);
this.isLoading = false;
+4 -3
View File
@@ -25,6 +25,7 @@
let isNewChatMode = $derived(page.url.searchParams.get('new_chat') === 'true');
let showSidebarByDefault = $derived(activeMessages().length > 0 || isLoading());
let sidebarOpen = $state(false);
let innerHeight = $state<number | undefined>();
let chatSidebar:
| { activateSearchMode?: () => void; editActiveConversation?: () => void }
| undefined = $state();
@@ -140,8 +141,6 @@
});
</script>
<svelte:window onkeydown={handleKeydown} />
<ModeWatcher />
<Toaster richColors />
@@ -157,7 +156,7 @@
/>
<Sidebar.Provider bind:open={sidebarOpen}>
<div class="flex h-screen w-full">
<div class="flex h-screen w-full" style:height="{innerHeight}px">
<Sidebar.Root class="h-full">
<ChatSidebar bind:this={chatSidebar} />
</Sidebar.Root>
@@ -174,3 +173,5 @@
</Sidebar.Inset>
</div>
</Sidebar.Provider>
<svelte:window onkeydown={handleKeydown} bind:innerHeight />