mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-09-17 20:31:47 +02:00
ui : drop unused currentResponse reactive writes
Nothing reads chatStore.currentResponse, but setChatStreaming reassigned it on every streamed chunk, so each token paid a reactive write and string assignment for nothing. Remove the field and the clearUIState wrapper that only reset it. Assisted-by: pi:zai-org/GLM-5.3
This commit is contained in:
@@ -55,7 +55,6 @@ class ChatStore implements ChatStreamHost, ChatFlowsHost {
|
||||
string,
|
||||
{ response: string; messageId: string; model?: string | null }
|
||||
>();
|
||||
currentResponse = $state('');
|
||||
errorDialogState = $state<ErrorDialogState | null>(null);
|
||||
// true while the active conversation has a local pipe (send, attach or resume-wait)
|
||||
isLoading = $derived(this.activity.isLocal(conversationsStore.activeConversation?.id ?? ''));
|
||||
@@ -256,8 +255,6 @@ class ChatStore implements ChatStreamHost, ChatFlowsHost {
|
||||
}
|
||||
|
||||
this.chatStreamingStates.delete(convId);
|
||||
|
||||
if (convId === conversationsStore.activeConversation?.id) this.currentResponse = '';
|
||||
}
|
||||
clearEditMode(): void {
|
||||
this.isEditModeActive = false;
|
||||
@@ -272,11 +269,6 @@ class ChatStore implements ChatStreamHost, ChatFlowsHost {
|
||||
this.pendingMessages.delete(convId);
|
||||
}
|
||||
|
||||
/** Reset per-view state when (re)mounting the empty chat screen. */
|
||||
clearUIState(): void {
|
||||
this.currentResponse = '';
|
||||
}
|
||||
|
||||
consumePendingDraft(): { message: string; files: ChatUploadedFile[] } | null {
|
||||
if (!this.pendingDraftMessage && this.pendingDraftFiles.length === 0) return null;
|
||||
|
||||
@@ -766,8 +758,6 @@ class ChatStore implements ChatStreamHost, ChatFlowsHost {
|
||||
model: model ?? this.chatStreamingStates.get(convId)?.model,
|
||||
response
|
||||
});
|
||||
|
||||
if (convId === conversationsStore.activeConversation?.id) this.currentResponse = response;
|
||||
}
|
||||
|
||||
setEditModeActive(handler: (files: File[]) => void): void {
|
||||
@@ -1244,7 +1234,6 @@ class ChatStore implements ChatStreamHost, ChatFlowsHost {
|
||||
syncLoadingStateForChat(convId: string): void {
|
||||
const s = this.chatStreamingStates.get(convId);
|
||||
|
||||
this.currentResponse = s?.response || '';
|
||||
this.processing.setActiveConversation(convId);
|
||||
|
||||
// Sync streaming content to activeMessages so UI displays current content
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { page } from '$app/state';
|
||||
import { DialogModelNotAvailable } from '$lib/components/app';
|
||||
import { APP_NAME, URL_PARAMS } from '$lib/constants';
|
||||
import { chatStore, conversationsStore, modelsStore, serverStore } from '$lib/stores';
|
||||
import { conversationsStore, modelsStore, serverStore } from '$lib/stores';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
let qParam = $derived(page.url.searchParams.get(URL_PARAMS.QUERY));
|
||||
@@ -77,7 +77,6 @@
|
||||
}
|
||||
|
||||
conversationsStore.clearActiveConversation();
|
||||
chatStore.clearUIState();
|
||||
|
||||
await modelsStore.fetch();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user