feat: Always show Mcp Selector
This commit is contained in:
parent
4c095df509
commit
bc07e0723d
|
|
@ -5,16 +5,13 @@
|
||||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||||
import { FILE_TYPE_ICONS } from '$lib/constants/icons';
|
import { FILE_TYPE_ICONS } from '$lib/constants/icons';
|
||||||
import { FileTypeCategory } from '$lib/enums';
|
import { FileTypeCategory } from '$lib/enums';
|
||||||
import McpLogo from '$lib/components/app/misc/McpLogo.svelte';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
class?: string;
|
class?: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
hasAudioModality?: boolean;
|
hasAudioModality?: boolean;
|
||||||
hasVisionModality?: boolean;
|
hasVisionModality?: boolean;
|
||||||
showMcpOption?: boolean;
|
|
||||||
onFileUpload?: (fileType?: FileTypeCategory) => void;
|
onFileUpload?: (fileType?: FileTypeCategory) => void;
|
||||||
onMcpClick?: () => void;
|
|
||||||
onSystemPromptClick?: () => void;
|
onSystemPromptClick?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -23,13 +20,11 @@
|
||||||
disabled = false,
|
disabled = false,
|
||||||
hasAudioModality = false,
|
hasAudioModality = false,
|
||||||
hasVisionModality = false,
|
hasVisionModality = false,
|
||||||
showMcpOption = false,
|
|
||||||
onFileUpload,
|
onFileUpload,
|
||||||
onMcpClick,
|
|
||||||
onSystemPromptClick
|
onSystemPromptClick
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
const fileUploadTooltipText = 'Add files or MCP servers';
|
const fileUploadTooltipText = 'Add files';
|
||||||
|
|
||||||
function handleFileUpload(fileType?: FileTypeCategory) {
|
function handleFileUpload(fileType?: FileTypeCategory) {
|
||||||
onFileUpload?.(fileType);
|
onFileUpload?.(fileType);
|
||||||
|
|
@ -127,18 +122,6 @@
|
||||||
{/if}
|
{/if}
|
||||||
</Tooltip.Root>
|
</Tooltip.Root>
|
||||||
|
|
||||||
{#if showMcpOption}
|
|
||||||
<DropdownMenu.Separator />
|
|
||||||
<DropdownMenu.Item
|
|
||||||
class="flex cursor-pointer items-center gap-2"
|
|
||||||
onclick={() => onMcpClick?.()}
|
|
||||||
>
|
|
||||||
<McpLogo style="width: 1rem; height: 1rem;" />
|
|
||||||
|
|
||||||
<span>MCP Servers</span>
|
|
||||||
</DropdownMenu.Item>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<DropdownMenu.Separator />
|
<DropdownMenu.Separator />
|
||||||
<Tooltip.Root>
|
<Tooltip.Root>
|
||||||
<Tooltip.Trigger class="w-full">
|
<Tooltip.Trigger class="w-full">
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
import { chatStore } from '$lib/stores/chat.svelte';
|
import { chatStore } from '$lib/stores/chat.svelte';
|
||||||
import { activeMessages, usedModalities } from '$lib/stores/conversations.svelte';
|
import { activeMessages, usedModalities } from '$lib/stores/conversations.svelte';
|
||||||
import { useModelChangeValidation } from '$lib/hooks/use-model-change-validation.svelte';
|
import { useModelChangeValidation } from '$lib/hooks/use-model-change-validation.svelte';
|
||||||
import { parseMcpServerSettings } from '$lib/config/mcp';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
canSend?: boolean;
|
canSend?: boolean;
|
||||||
|
|
@ -168,10 +167,6 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
let showMcpDialog = $state(false);
|
let showMcpDialog = $state(false);
|
||||||
|
|
||||||
// MCP servers state (simplified - just need to check if any exist)
|
|
||||||
let mcpServers = $derived(parseMcpServerSettings(currentConfig.mcpServers));
|
|
||||||
let hasMcpServers = $derived(mcpServers.length > 0);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex w-full items-center gap-3 {className}" style="container-type: inline-size">
|
<div class="flex w-full items-center gap-3 {className}" style="container-type: inline-size">
|
||||||
|
|
@ -180,15 +175,11 @@
|
||||||
{disabled}
|
{disabled}
|
||||||
{hasAudioModality}
|
{hasAudioModality}
|
||||||
{hasVisionModality}
|
{hasVisionModality}
|
||||||
showMcpOption={!hasMcpServers}
|
|
||||||
onMcpClick={() => (showMcpDialog = true)}
|
|
||||||
{onFileUpload}
|
{onFileUpload}
|
||||||
{onSystemPromptClick}
|
{onSystemPromptClick}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{#if hasMcpServers}
|
<McpSelector {disabled} onSettingsClick={() => (showMcpDialog = true)} />
|
||||||
<McpSelector {disabled} onSettingsClick={() => (showMcpDialog = true)} />
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ml-auto flex items-center gap-1.5">
|
<div class="ml-auto flex items-center gap-1.5">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue