refactor: remove anything related to the custom chat width setting

This commit is contained in:
Imad Saddik 2026-03-15 16:54:43 +00:00
parent 20a8227933
commit 2836834801
13 changed files with 7 additions and 72 deletions

View File

@ -18,7 +18,6 @@
interface Props {
class?: string;
style?: string;
message: DatabaseMessage;
isLastAssistantMessage?: boolean;
siblingInfo?: ChatMessageSiblingInfo | null;
@ -26,7 +25,6 @@
let {
class: className = '',
style,
message,
isLastAssistantMessage = false,
siblingInfo = null
@ -281,7 +279,6 @@
{:else if message.role === MessageRole.USER}
<ChatMessageUser
class={className}
{style}
{deletionInfo}
{message}
onConfirmDelete={handleConfirmDelete}
@ -297,7 +294,6 @@
<ChatMessageAssistant
bind:textareaElement
class={className}
{style}
{deletionInfo}
{isLastAssistantMessage}
{message}

View File

@ -27,7 +27,6 @@
interface Props {
class?: string;
style?: string;
deletionInfo: {
totalCount: number;
userMessages: number;
@ -52,7 +51,6 @@
let {
class: className = '',
style,
deletionInfo,
isLastAssistantMessage = false,
message,
@ -197,12 +195,11 @@
<div
class="text-md group w-full leading-7.5 {className}"
{style}
role="group"
aria-label="Assistant message with actions"
>
{#if showProcessingInfoTop}
<div class="mt-6 w-full {className}" {style} in:fade>
<div class="mt-6 w-full {className}" in:fade>
<div class="processing-container">
<span class="processing-text">
{processingState.getPromptProgressText() ??

View File

@ -9,7 +9,6 @@
interface Props {
class?: string;
style?: string;
message: DatabaseMessage;
siblingInfo?: ChatMessageSiblingInfo | null;
deletionInfo: {
@ -29,7 +28,6 @@
let {
class: className = '',
style,
message,
siblingInfo = null,
deletionInfo,
@ -77,7 +75,6 @@
<div
aria-label="User message with actions"
class="group flex flex-col items-end gap-3 md:gap-2 {className}"
{style}
role="group"
>
{#if editCtx.isEditing}

View File

@ -146,7 +146,6 @@
{#each displayMessages as { message, isLastAssistantMessage, siblingInfo } (message.id)}
<ChatMessage
class="mx-auto w-full {widthClasses.class}"
style={widthClasses.style}
{message}
{isLastAssistantMessage}
{siblingInfo}

View File

@ -379,7 +379,6 @@
{#if hasPropsError}
<div
class="pointer-events-auto mx-auto mb-4 {widthClasses.class} px-1"
style={widthClasses.style}
in:fly={{ y: 10, duration: 250 }}
>
<Alert.Root variant="destructive">
@ -429,7 +428,7 @@
ondrop={handleDrop}
role="main"
>
<div class="w-full {widthClasses.class} px-4" style={widthClasses.style}>
<div class="w-full {widthClasses.class} px-4">
<div class="mb-10 text-center" in:fade={{ duration: 300 }}>
<h1 class="mb-2 text-2xl font-semibold tracking-tight md:text-3xl">llama.cpp</h1>

View File

@ -104,7 +104,7 @@
});
</script>
<div class="relative mx-auto {widthClasses.class}" style={widthClasses.style}>
<div class="relative mx-auto {widthClasses.class}">
<ChatForm
bind:this={chatFormRef}
bind:value={message}

View File

@ -96,11 +96,6 @@
label: 'Automatic width',
type: SettingsFieldType.CHECKBOX
},
{
key: SETTINGS_KEYS.CUSTOM_CHAT_WIDTH,
label: 'Custom width',
type: SettingsFieldType.COMBOBOX
},
{
key: SETTINGS_KEYS.SHOW_MESSAGE_STATS,
label: 'Show message generation statistics',

View File

@ -1,7 +1,4 @@
export const DEFAULT_WIDTH = 'max-w-[48rem]';
export const MIN_CUSTOM_WIDTH = 300;
export const MAX_CUSTOM_WIDTH = 10000;
export const DEFAULT_WIDTH_CLASS = 'max-w-[48rem]';
export const AUTO_WIDTH_CLASSES = `
max-w-[48rem]
@ -12,17 +9,3 @@ export const AUTO_WIDTH_CLASSES = `
4xl:max-w-[100rem]
5xl:max-w-[150rem]
`;
export const CUSTOM_WIDTH_PRESETS = {
xs: 480,
sm: 600,
md: 768,
lg: 960,
xl: 1152,
'2xl': 1280,
'3xl': 1440,
'4xl': 1600,
'5xl': 1920,
'6xl': 2304,
'7xl': 3072
} as const;

View File

@ -13,7 +13,6 @@ export const SETTING_CONFIG_DEFAULT: Record<string, string | number | boolean> =
showRawOutputSwitch: false,
keepStatsVisible: false,
autoChatWidth: false,
customChatWidth: '',
showMessageStats: true,
askForTitleConfirmation: false,
pasteLongTextToFileLen: 2500,
@ -110,8 +109,6 @@ export const SETTING_CONFIG_INFO: Record<string, string> = {
keepStatsVisible: 'Keep processing statistics visible after generation finishes.',
autoChatWidth:
'Automatically adapt the chat width to your screen size. If enabled, this ignores the custom width setting.',
customChatWidth:
'Set a specific width for the chat. You can use presets (xs to 7xl) or type a pixel value (e.g. 800).',
showMessageStats:
'Display generation statistics (tokens/second, token count, duration) below each assistant message.',
askForTitleConfirmation:

View File

@ -54,7 +54,6 @@ export const SETTINGS_KEYS = {
SHOW_TOOL_CALL_IN_PROGRESS: 'showToolCallInProgress',
// Chat width
AUTO_CHAT_WIDTH: 'autoChatWidth',
CUSTOM_CHAT_WIDTH: 'customChatWidth',
// Developer
DISABLE_REASONING_PARSING: 'disableReasoningParsing',
SHOW_RAW_OUTPUT_SWITCH: 'showRawOutputSwitch',

View File

@ -22,6 +22,5 @@ export enum SettingsFieldType {
INPUT = 'input',
TEXTAREA = 'textarea',
CHECKBOX = 'checkbox',
SELECT = 'select',
COMBOBOX = 'combobox'
SELECT = 'select'
}

View File

@ -118,12 +118,6 @@ export const SYNCABLE_PARAMETERS: SyncableParameter[] = [
type: SyncableParameterType.BOOLEAN,
canSync: true
},
{
key: 'customChatWidth',
serverKey: 'customChatWidth',
type: SyncableParameterType.STRING,
canSync: true
},
{
key: 'showMessageStats',
serverKey: 'showMessageStats',

View File

@ -36,8 +36,7 @@ import {
REASONING_TAGS,
SYSTEM_MESSAGE_PLACEHOLDER,
AUTO_WIDTH_CLASSES,
CUSTOM_WIDTH_PRESETS,
DEFAULT_WIDTH
DEFAULT_WIDTH_CLASS
} from '$lib/constants';
import type {
ChatMessageTimings,
@ -85,31 +84,12 @@ class ChatStore {
get chatWidthClasses(): { class: string; style?: string } {
const currentConfig = config();
const autoChatWidth = currentConfig.autoChatWidth;
const customChatWidth = currentConfig.customChatWidth;
if (autoChatWidth) {
return { class: AUTO_WIDTH_CLASSES };
}
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 { class: DEFAULT_WIDTH };
return { class: DEFAULT_WIDTH_CLASS };
}
private setChatLoading(convId: string, loading: boolean): void {