From fba573e1efd451cc9f2a51ea6932b3058aa2fa22 Mon Sep 17 00:00:00 2001 From: "Thomas G. Lopes" <26071571+TGlide@users.noreply.github.com> Date: Wed, 18 Jun 2025 01:40:09 +0100 Subject: [PATCH] ugly model picker --- src/routes/chat/model-picker.svelte | 37 +++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/src/routes/chat/model-picker.svelte b/src/routes/chat/model-picker.svelte index c18e340..4b8c2f1 100644 --- a/src/routes/chat/model-picker.svelte +++ b/src/routes/chat/model-picker.svelte @@ -22,6 +22,11 @@ import CpuIcon from '~icons/lucide/cpu'; import RobotIcon from '~icons/lucide/bot'; + // Model-specific icons + import LogosClaudeIcon from '~icons/logos/claude-icon'; + import MaterialIconThemeGeminiAi from '~icons/material-icon-theme/gemini-ai'; + import LogosMistralAiIcon from '~icons/logos/mistral-ai-icon'; + type Props = { class?: string; }; @@ -48,6 +53,17 @@ cohere: CpuIcon, }; + // Function to get model-specific icon + function getModelIcon(modelId: string): typeof LogosClaudeIcon | null { + const id = modelId.toLowerCase(); + + if (id.includes('claude') || id.includes('anthropic')) return LogosClaudeIcon; + if (id.includes('gemini') || id.includes('gemma')) return MaterialIconThemeGeminiAi; + if (id.includes('mistral') || id.includes('mixtral')) return LogosMistralAiIcon; + + return null; + } + // Function to extract company from model ID function getCompanyFromModelId(modelId: string): string { const id = modelId.toLowerCase(); @@ -176,7 +192,7 @@ class="flex h-10 w-full rounded-md border-0 border-b bg-transparent px-3 py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50" placeholder="Search models..." /> - + No models available. Enable some models in the account settings. @@ -192,22 +208,29 @@ {/if} {company} ({models.length}) - + {#each models as model (model._id)} selectModel(model.model_id)} class={cn( - 'data-selected:bg-accent data-selected:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-md px-3 py-2 text-sm outline-none transition-colors', - settings.modelId === model.model_id && 'bg-primary text-primary-foreground' + 'data-selected:bg-accent data-selected:text-accent-foreground relative flex cursor-pointer select-none flex-col items-center justify-center rounded-lg border border-gray-200 bg-white px-3 py-4 text-sm outline-none transition-all hover:border-gray-300 hover:shadow-sm dark:border-gray-700 dark:bg-gray-800 dark:hover:border-gray-600', + settings.modelId === model.model_id && 'bg-primary border-primary text-primary-foreground shadow-md' )} > -
- +
+ {#if getModelIcon(model.model_id)} + {@const ModelIcon = getModelIcon(model.model_id)} + + {:else if companyIcons[getCompanyFromModelId(model.model_id)]} + {@const CompanyIcon = companyIcons[getCompanyFromModelId(model.model_id)]} + + {/if} + {model.model_id.replace(/^[^/]+\//, '')} {#if settings.modelId === model.model_id} - + {/if}