refactor: Consolidate MCP server settings into ChatSettings

This commit is contained in:
Aleksander Grygier 2026-02-08 23:44:38 +01:00
parent 05d1a47e88
commit 4b752d7113
6 changed files with 22 additions and 38 deletions

View File

@ -8,7 +8,8 @@
McpServersSelector,
ModelsSelector
} from '$lib/components/app';
import { DialogMcpServersSettings } from '$lib/components/app/dialogs';
import { DialogChatSettings } from '$lib/components/app/dialogs';
import { SETTINGS_SECTION_TITLES } from '$lib/constants/settings-sections';
import { mcpStore } from '$lib/stores/mcp.svelte';
import { FileTypeCategory } from '$lib/enums';
import { getFileTypeCategory } from '$lib/utils';
@ -230,7 +231,8 @@
{/if}
</div>
<DialogMcpServersSettings
bind:open={showMcpDialog}
<DialogChatSettings
open={showMcpDialog}
onOpenChange={(open) => (showMcpDialog = open)}
initialSection={SETTINGS_SECTION_TITLES.MCP}
/>

View File

@ -28,9 +28,10 @@
interface Props {
onSave?: () => void;
initialSection?: SettingsSectionTitle;
}
let { onSave }: Props = $props();
let { onSave, initialSection }: Props = $props();
const settingSections: Array<{
fields: SettingsFieldConfig[];
@ -307,7 +308,15 @@
// }
];
let activeSection = $state<SettingsSectionTitle>(SETTINGS_SECTION_TITLES.GENERAL);
let activeSection = $state<SettingsSectionTitle>(
initialSection ?? SETTINGS_SECTION_TITLES.GENERAL
);
$effect(() => {
if (initialSection) {
activeSection = initialSection;
}
});
let currentSection = $derived(
settingSections.find((section) => section.title === activeSection) || settingSections[0]
);

View File

@ -634,7 +634,7 @@ export { default as ChatScreenProcessingInfo } from './ChatScreen/ChatScreenProc
* - **Sampling**: Temperature, top_p, top_k, min_p, repeat_penalty, etc.
* - **Penalties**: Frequency penalty, presence penalty, repeat last N
* - **Import/Export**: Conversation backup and restore
* - **MCP**: MCP server management (opens DialogMcpServersSettings)
* - **MCP**: MCP server management (opens DialogChatSettings with MCP tab)
* - **Developer**: Debug options, disable auto-scroll
*
* **Parameter Sync:**

View File

@ -1,13 +1,15 @@
<script lang="ts">
import * as Dialog from '$lib/components/ui/dialog';
import { ChatSettings } from '$lib/components/app';
import type { SettingsSectionTitle } from '$lib/constants/settings-sections';
interface Props {
onOpenChange?: (open: boolean) => void;
open?: boolean;
initialSection?: SettingsSectionTitle;
}
let { onOpenChange, open = false }: Props = $props();
let { onOpenChange, open = false, initialSection }: Props = $props();
let chatSettingsRef: ChatSettings | undefined = $state();
@ -31,6 +33,6 @@
class="z-999999 flex h-[100dvh] max-h-[100dvh] min-h-[100dvh] max-w-4xl! flex-col gap-0 rounded-none
p-0 md:h-[64vh] md:max-h-[64vh] md:min-h-0 md:rounded-lg"
>
<ChatSettings bind:this={chatSettingsRef} onSave={handleSave} />
<ChatSettings bind:this={chatSettingsRef} onSave={handleSave} {initialSection} />
</Dialog.Content>
</Dialog.Root>

View File

@ -36,35 +36,6 @@
*/
export { default as DialogChatSettings } from './DialogChatSettings.svelte';
/**
* **DialogMcpServersSettings** - MCP servers configuration dialog
*
* Full-screen dialog for managing MCP Server
* connections with add/edit/delete capabilities and health monitoring.
* Opened from McpActiveServerAvatars or ChatFormActionAttachentsDropdown.
*
* **Architecture:**
* - Uses ShadCN Dialog
* - Integrates with mcpStore for server CRUD operations
* - Manages connection state and health checks
*
* **Features:**
* - Add new MCP servers by URL with validation
* - Edit existing server configuration (URL, headers)
* - Delete servers with confirmation dialog
* - Health check status indicators (connected/disconnected/error)
* - Connection logs display for debugging
* - Tools list per server showing available capabilities
* - Enable/disable servers per conversation
* - Custom HTTP headers support
*
* @example
* ```svelte
* <DialogMcpServersSettings bind:open={showMcpSettings} />
* ```
*/
export { default as DialogMcpServersSettings } from './DialogMcpServersSettings.svelte';
/**
*
* CONFIRMATION DIALOGS

View File

@ -16,7 +16,7 @@
*
* Settings section for configuring MCP server connections.
* Displays server cards with status, tools, and management actions.
* Used within DialogMcpServersSettings.
* Used within the MCP tab of ChatSettings.
*
* **Architecture:**
* - Manages add server form state locally