refactor: Remove redundant settings

This commit is contained in:
Aleksander Grygier 2025-11-25 10:55:08 +01:00
parent fed6c82eeb
commit f9c911d025
6 changed files with 12 additions and 33 deletions

View File

@ -93,8 +93,6 @@
let currentConfig = $derived(config());
let isRouter = $derived(isRouterMode());
let displayedModel = $derived((): string | null => {
if (!currentConfig.showModelInfo) return null;
// Only show model from streaming data, no fallbacks to server props
if (message.model) {
return message.model;
@ -254,7 +252,7 @@
<div class="info my-6 grid gap-4">
{#if displayedModel()}
<span class="inline-flex flex-wrap items-center gap-2 text-xs text-muted-foreground">
{#if isRouter && currentConfig.modelSelectorEnabled}
{#if isRouter}
<SelectorModel
currentModel={displayedModel()}
onModelChange={handleModelChange}

View File

@ -99,11 +99,6 @@
label: 'Keep stats visible after generation',
type: 'checkbox'
},
{
key: 'showModelInfo',
label: 'Show model information',
type: 'checkbox'
},
{
key: 'disableAutoScroll',
label: 'Disable automatic scroll',
@ -238,11 +233,6 @@
title: 'Developer',
icon: Code,
fields: [
{
key: 'modelSelectorEnabled',
label: 'Enable model selector',
type: 'checkbox'
},
{
key: 'showToolCalls',
label: 'Show tool call labels',

View File

@ -13,10 +13,8 @@ export const SETTING_CONFIG_DEFAULT: Record<string, string | number | boolean> =
askForTitleConfirmation: false,
pasteLongTextToFileLen: 2500,
pdfAsImage: false,
showModelInfo: false,
disableAutoScroll: false,
renderUserContentAsMarkdown: false,
modelSelectorEnabled: false,
autoMicOnEmpty: false,
// make sure these default values are in sync with `common.h`
samplers: 'top_k;typ_p;top_p;min_p;temperature',
@ -94,12 +92,9 @@ export const SETTING_CONFIG_INFO: Record<string, string> = {
askForTitleConfirmation:
'Ask for confirmation before automatically changing conversation title when editing the first message.',
pdfAsImage: 'Parse PDF as image instead of text (requires vision-capable model).',
showModelInfo: 'Display the model name used to generate each message below the message content.',
disableAutoScroll:
'Disable automatic scrolling while messages stream so you can control the viewport position manually.',
renderUserContentAsMarkdown: 'Render user messages using markdown formatting in the chat.',
modelSelectorEnabled:
'Enable the model selector in the chat input to choose the inference model. Sends the associated model field in API requests.',
autoMicOnEmpty:
'Automatically show microphone button instead of send button when textarea is empty for models with audio modality support.',
pyInterpreterEnabled:

View File

@ -1,5 +1,6 @@
import { config } from '$lib/stores/settings.svelte';
import { selectedModelName } from '$lib/stores/models.svelte';
import { isRouterMode } from '$lib/stores/server.svelte';
import { slotsService } from './slots';
import type {
ApiChatCompletionRequest,
@ -149,10 +150,10 @@ export class ChatService {
stream
};
const modelSelectorEnabled = Boolean(currentConfig.modelSelectorEnabled);
const activeModel = modelSelectorEnabled ? selectedModelName() : null;
const isRouter = isRouterMode();
const activeModel = isRouter ? selectedModelName() : null;
if (modelSelectorEnabled && activeModel) {
if (isRouter && activeModel) {
requestBody.model = activeModel;
}

View File

@ -3,7 +3,6 @@ import { SERVER_PROPS_LOCALSTORAGE_KEY } from '$lib/constants/localstorage-keys'
import { PropsService } from '$lib/services/props';
import { config } from '$lib/stores/settings.svelte';
import { ServerMode, ModelModality } from '$lib/enums';
import { updateConfig } from '$lib/stores/settings.svelte';
/**
* ServerStore - Server state management and capability detection
@ -251,11 +250,6 @@ class ServerStore {
if (props.model_path === 'none') {
this._serverMode = ServerMode.ROUTER;
console.info('Server running in ROUTER mode (multi-model management)');
// Auto-enable model selector in router mode
if (browser) {
updateConfig('modelSelectorEnabled', true);
}
} else {
this._serverMode = ServerMode.MODEL;
console.info('Server running in MODEL mode (single model)');

View File

@ -3,6 +3,7 @@
import ChatSidebar from '$lib/components/app/chat/ChatSidebar/ChatSidebar.svelte';
import { waitFor } from 'storybook/test';
import { screen } from 'storybook/test';
import type { DatabaseConversation } from '$lib/types/database';
const { Story } = defineMeta({
title: 'Components/ChatSidebar',
@ -51,10 +52,10 @@
asChild
name="Default"
play={async () => {
const { chatStore } = await import('$lib/stores/chat.svelte');
const { conversationsStore } = await import('$lib/stores/conversations.svelte');
waitFor(() => setTimeout(() => {
chatStore.conversations = mockConversations;
conversationsStore.conversations = mockConversations;
}, 0));
}}
>
@ -67,10 +68,10 @@
asChild
name="SearchActive"
play={async ({ userEvent }) => {
const { chatStore } = await import('$lib/stores/chat.svelte');
const { conversationsStore } = await import('$lib/stores/conversations.svelte');
waitFor(() => setTimeout(() => {
chatStore.conversations = mockConversations;
conversationsStore.conversations = mockConversations;
}, 0));
const searchTrigger = screen.getByText('Search conversations');
@ -87,8 +88,8 @@
name="Empty"
play={async () => {
// Mock empty conversations store
const { chatStore } = await import('$lib/stores/chat.svelte');
chatStore.conversations = [];
const { conversationsStore } = await import('$lib/stores/conversations.svelte');
conversationsStore.conversations = [];
}}
>
<div class="flex-column h-full h-screen w-72 bg-background">