+
{#each processingDetails as detail (detail)}
{detail}
{/each}
diff --git a/tools/server/webui/src/lib/stores/chat.svelte.ts b/tools/server/webui/src/lib/stores/chat.svelte.ts
index 67157e36ac..7d6205544a 100644
--- a/tools/server/webui/src/lib/stores/chat.svelte.ts
+++ b/tools/server/webui/src/lib/stores/chat.svelte.ts
@@ -15,6 +15,7 @@ import {
} from '$lib/utils';
import { SvelteMap } from 'svelte/reactivity';
import { DEFAULT_CONTEXT } from '$lib/constants/default-context';
+import { AUTO_WIDTH_CLASSES, CUSTOM_WIDTH_PRESETS, DEFAULT_WIDTH } from '$lib/constants/chat-width';
/**
* chatStore - Active AI interaction and streaming state management
@@ -77,6 +78,32 @@ class ChatStore {
private isEditModeActive = $state(false);
private addFilesHandler: ((files: File[]) => void) | null = $state(null);
+ get chatWidthClasses(): { class: string; style?: string } {
+ const currentConfig = config();
+ const customChatWidth = currentConfig.customChatWidth;
+
+ // Custom width takes priority if set
+ if (customChatWidth) {
+ let pixelValue: number | null = null;
+
+ if (customChatWidth in CUSTOM_WIDTH_PRESETS) {
+ const preset = customChatWidth as keyof typeof CUSTOM_WIDTH_PRESETS;
+ pixelValue = CUSTOM_WIDTH_PRESETS[preset];
+ } else {
+ // User typed a number directly instead of selecting a preset
+ const number = Number(customChatWidth);
+ if (!isNaN(number) && number > 0) {
+ pixelValue = number;
+ }
+ }
+ if (pixelValue !== null) {
+ return { class: '', style: `max-width: ${pixelValue}px` };
+ }
+ }
+
+ return currentConfig.autoChatWidth ? { class: AUTO_WIDTH_CLASSES } : { class: DEFAULT_WIDTH };
+ }
+
// ─────────────────────────────────────────────────────────────────────────────
// Loading State
// ─────────────────────────────────────────────────────────────────────────────
@@ -1483,3 +1510,4 @@ export const isEditing = () => chatStore.isEditing();
export const isLoading = () => chatStore.isLoading;
export const setEditModeActive = (handler: (files: File[]) => void) =>
chatStore.setEditModeActive(handler);
+export const chatWidthClasses = () => chatStore.chatWidthClasses;
diff --git a/tools/server/webui/src/lib/utils/chat-width.ts b/tools/server/webui/src/lib/utils/chat-width.ts
deleted file mode 100644
index 532b5b69b1..0000000000
--- a/tools/server/webui/src/lib/utils/chat-width.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { AUTO_WIDTH_CLASSES, CUSTOM_WIDTH_PRESETS, DEFAULT_WIDTH } from '$lib/constants/chat-width';
-
-export type CustomWidthPreset = keyof typeof CUSTOM_WIDTH_PRESETS;
-
-/**
- * Get the appropriate width configuration based on settings
- * @param autoChatWidth - Whether automatic responsive width is enabled
- * @param customChatWidth - Custom width setting (preset key or pixel value)
- */
-export function getChatWidth(
- autoChatWidth: boolean,
- customChatWidth: string
-): { class: string; style?: string } {
- if (autoChatWidth) {
- return { class: AUTO_WIDTH_CLASSES };
- }
-
- if (customChatWidth) {
- if (customChatWidth in CUSTOM_WIDTH_PRESETS) {
- const pixelValue = CUSTOM_WIDTH_PRESETS[customChatWidth as CustomWidthPreset];
- return { class: '', style: `max-width: ${pixelValue}px` };
- }
-
- const numValue = Number(customChatWidth);
- if (!isNaN(numValue) && numValue > 0) {
- return { class: '', style: `max-width: ${numValue}px` };
- }
- }
-
- return { class: DEFAULT_WIDTH };
-}