refactor: Remove redundant settings
This commit is contained in:
parent
fed6c82eeb
commit
f9c911d025
|
|
@ -93,8 +93,6 @@
|
||||||
let currentConfig = $derived(config());
|
let currentConfig = $derived(config());
|
||||||
let isRouter = $derived(isRouterMode());
|
let isRouter = $derived(isRouterMode());
|
||||||
let displayedModel = $derived((): string | null => {
|
let displayedModel = $derived((): string | null => {
|
||||||
if (!currentConfig.showModelInfo) return null;
|
|
||||||
|
|
||||||
// Only show model from streaming data, no fallbacks to server props
|
// Only show model from streaming data, no fallbacks to server props
|
||||||
if (message.model) {
|
if (message.model) {
|
||||||
return message.model;
|
return message.model;
|
||||||
|
|
@ -254,7 +252,7 @@
|
||||||
<div class="info my-6 grid gap-4">
|
<div class="info my-6 grid gap-4">
|
||||||
{#if displayedModel()}
|
{#if displayedModel()}
|
||||||
<span class="inline-flex flex-wrap items-center gap-2 text-xs text-muted-foreground">
|
<span class="inline-flex flex-wrap items-center gap-2 text-xs text-muted-foreground">
|
||||||
{#if isRouter && currentConfig.modelSelectorEnabled}
|
{#if isRouter}
|
||||||
<SelectorModel
|
<SelectorModel
|
||||||
currentModel={displayedModel()}
|
currentModel={displayedModel()}
|
||||||
onModelChange={handleModelChange}
|
onModelChange={handleModelChange}
|
||||||
|
|
|
||||||
|
|
@ -99,11 +99,6 @@
|
||||||
label: 'Keep stats visible after generation',
|
label: 'Keep stats visible after generation',
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'showModelInfo',
|
|
||||||
label: 'Show model information',
|
|
||||||
type: 'checkbox'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'disableAutoScroll',
|
key: 'disableAutoScroll',
|
||||||
label: 'Disable automatic scroll',
|
label: 'Disable automatic scroll',
|
||||||
|
|
@ -238,11 +233,6 @@
|
||||||
title: 'Developer',
|
title: 'Developer',
|
||||||
icon: Code,
|
icon: Code,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
|
||||||
key: 'modelSelectorEnabled',
|
|
||||||
label: 'Enable model selector',
|
|
||||||
type: 'checkbox'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'showToolCalls',
|
key: 'showToolCalls',
|
||||||
label: 'Show tool call labels',
|
label: 'Show tool call labels',
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,8 @@ export const SETTING_CONFIG_DEFAULT: Record<string, string | number | boolean> =
|
||||||
askForTitleConfirmation: false,
|
askForTitleConfirmation: false,
|
||||||
pasteLongTextToFileLen: 2500,
|
pasteLongTextToFileLen: 2500,
|
||||||
pdfAsImage: false,
|
pdfAsImage: false,
|
||||||
showModelInfo: false,
|
|
||||||
disableAutoScroll: false,
|
disableAutoScroll: false,
|
||||||
renderUserContentAsMarkdown: false,
|
renderUserContentAsMarkdown: false,
|
||||||
modelSelectorEnabled: false,
|
|
||||||
autoMicOnEmpty: false,
|
autoMicOnEmpty: false,
|
||||||
// make sure these default values are in sync with `common.h`
|
// make sure these default values are in sync with `common.h`
|
||||||
samplers: 'top_k;typ_p;top_p;min_p;temperature',
|
samplers: 'top_k;typ_p;top_p;min_p;temperature',
|
||||||
|
|
@ -94,12 +92,9 @@ export const SETTING_CONFIG_INFO: Record<string, string> = {
|
||||||
askForTitleConfirmation:
|
askForTitleConfirmation:
|
||||||
'Ask for confirmation before automatically changing conversation title when editing the first message.',
|
'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).',
|
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:
|
disableAutoScroll:
|
||||||
'Disable automatic scrolling while messages stream so you can control the viewport position manually.',
|
'Disable automatic scrolling while messages stream so you can control the viewport position manually.',
|
||||||
renderUserContentAsMarkdown: 'Render user messages using markdown formatting in the chat.',
|
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:
|
autoMicOnEmpty:
|
||||||
'Automatically show microphone button instead of send button when textarea is empty for models with audio modality support.',
|
'Automatically show microphone button instead of send button when textarea is empty for models with audio modality support.',
|
||||||
pyInterpreterEnabled:
|
pyInterpreterEnabled:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { config } from '$lib/stores/settings.svelte';
|
import { config } from '$lib/stores/settings.svelte';
|
||||||
import { selectedModelName } from '$lib/stores/models.svelte';
|
import { selectedModelName } from '$lib/stores/models.svelte';
|
||||||
|
import { isRouterMode } from '$lib/stores/server.svelte';
|
||||||
import { slotsService } from './slots';
|
import { slotsService } from './slots';
|
||||||
import type {
|
import type {
|
||||||
ApiChatCompletionRequest,
|
ApiChatCompletionRequest,
|
||||||
|
|
@ -149,10 +150,10 @@ export class ChatService {
|
||||||
stream
|
stream
|
||||||
};
|
};
|
||||||
|
|
||||||
const modelSelectorEnabled = Boolean(currentConfig.modelSelectorEnabled);
|
const isRouter = isRouterMode();
|
||||||
const activeModel = modelSelectorEnabled ? selectedModelName() : null;
|
const activeModel = isRouter ? selectedModelName() : null;
|
||||||
|
|
||||||
if (modelSelectorEnabled && activeModel) {
|
if (isRouter && activeModel) {
|
||||||
requestBody.model = activeModel;
|
requestBody.model = activeModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import { SERVER_PROPS_LOCALSTORAGE_KEY } from '$lib/constants/localstorage-keys'
|
||||||
import { PropsService } from '$lib/services/props';
|
import { PropsService } from '$lib/services/props';
|
||||||
import { config } from '$lib/stores/settings.svelte';
|
import { config } from '$lib/stores/settings.svelte';
|
||||||
import { ServerMode, ModelModality } from '$lib/enums';
|
import { ServerMode, ModelModality } from '$lib/enums';
|
||||||
import { updateConfig } from '$lib/stores/settings.svelte';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ServerStore - Server state management and capability detection
|
* ServerStore - Server state management and capability detection
|
||||||
|
|
@ -251,11 +250,6 @@ class ServerStore {
|
||||||
if (props.model_path === 'none') {
|
if (props.model_path === 'none') {
|
||||||
this._serverMode = ServerMode.ROUTER;
|
this._serverMode = ServerMode.ROUTER;
|
||||||
console.info('Server running in ROUTER mode (multi-model management)');
|
console.info('Server running in ROUTER mode (multi-model management)');
|
||||||
|
|
||||||
// Auto-enable model selector in router mode
|
|
||||||
if (browser) {
|
|
||||||
updateConfig('modelSelectorEnabled', true);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this._serverMode = ServerMode.MODEL;
|
this._serverMode = ServerMode.MODEL;
|
||||||
console.info('Server running in MODEL mode (single model)');
|
console.info('Server running in MODEL mode (single model)');
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
import ChatSidebar from '$lib/components/app/chat/ChatSidebar/ChatSidebar.svelte';
|
import ChatSidebar from '$lib/components/app/chat/ChatSidebar/ChatSidebar.svelte';
|
||||||
import { waitFor } from 'storybook/test';
|
import { waitFor } from 'storybook/test';
|
||||||
import { screen } from 'storybook/test';
|
import { screen } from 'storybook/test';
|
||||||
|
import type { DatabaseConversation } from '$lib/types/database';
|
||||||
|
|
||||||
const { Story } = defineMeta({
|
const { Story } = defineMeta({
|
||||||
title: 'Components/ChatSidebar',
|
title: 'Components/ChatSidebar',
|
||||||
|
|
@ -51,10 +52,10 @@
|
||||||
asChild
|
asChild
|
||||||
name="Default"
|
name="Default"
|
||||||
play={async () => {
|
play={async () => {
|
||||||
const { chatStore } = await import('$lib/stores/chat.svelte');
|
const { conversationsStore } = await import('$lib/stores/conversations.svelte');
|
||||||
|
|
||||||
waitFor(() => setTimeout(() => {
|
waitFor(() => setTimeout(() => {
|
||||||
chatStore.conversations = mockConversations;
|
conversationsStore.conversations = mockConversations;
|
||||||
}, 0));
|
}, 0));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
@ -67,10 +68,10 @@
|
||||||
asChild
|
asChild
|
||||||
name="SearchActive"
|
name="SearchActive"
|
||||||
play={async ({ userEvent }) => {
|
play={async ({ userEvent }) => {
|
||||||
const { chatStore } = await import('$lib/stores/chat.svelte');
|
const { conversationsStore } = await import('$lib/stores/conversations.svelte');
|
||||||
|
|
||||||
waitFor(() => setTimeout(() => {
|
waitFor(() => setTimeout(() => {
|
||||||
chatStore.conversations = mockConversations;
|
conversationsStore.conversations = mockConversations;
|
||||||
}, 0));
|
}, 0));
|
||||||
|
|
||||||
const searchTrigger = screen.getByText('Search conversations');
|
const searchTrigger = screen.getByText('Search conversations');
|
||||||
|
|
@ -87,8 +88,8 @@
|
||||||
name="Empty"
|
name="Empty"
|
||||||
play={async () => {
|
play={async () => {
|
||||||
// Mock empty conversations store
|
// Mock empty conversations store
|
||||||
const { chatStore } = await import('$lib/stores/chat.svelte');
|
const { conversationsStore } = await import('$lib/stores/conversations.svelte');
|
||||||
chatStore.conversations = [];
|
conversationsStore.conversations = [];
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class="flex-column h-full h-screen w-72 bg-background">
|
<div class="flex-column h-full h-screen w-72 bg-background">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue