From c357a1cd1dba7fe43675151a9d9eff233f1ba518 Mon Sep 17 00:00:00 2001 From: Till JS Date: Tue, 14 Apr 2026 14:15:30 +0200 Subject: [PATCH] feat(brain): AI tier selector in Companion chat toolbar Dropdown at the top of the chat with options: Auto, Keine, Browser, Mana-Server, Cloud. Selecting a tier sets settings.taskOverrides['companion.chat'] so the choice only affects the Companion, not other LLM tasks. "Auto" clears the override and lets the orchestrator pick the user's preferred tier. Also shows the current auto-selected tier inline so the user knows what Auto resolves to, e.g. "Auto (Browser)". Co-Authored-By: Claude Opus 4.6 (1M context) --- .../companion/components/CompanionChat.svelte | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/apps/mana/apps/web/src/lib/modules/companion/components/CompanionChat.svelte b/apps/mana/apps/web/src/lib/modules/companion/components/CompanionChat.svelte index 0f0d486a2..7e78c5dba 100644 --- a/apps/mana/apps/web/src/lib/modules/companion/components/CompanionChat.svelte +++ b/apps/mana/apps/web/src/lib/modules/companion/components/CompanionChat.svelte @@ -9,6 +9,13 @@ import { marked } from 'marked'; import { PaperPlaneRight, Robot, User, Lightning, CircleNotch } from '@mana/shared-icons'; import { getLocalLlmStatus } from '@mana/local-llm'; + import { + llmSettingsState, + updateLlmSettings, + ALL_TIERS, + tierLabel, + type LlmTier, + } from '@mana/shared-llm'; import { chatStore } from '../stores/chat.svelte'; import { runCompanionChat } from '../engine'; import { useMessages } from '../queries'; @@ -52,6 +59,31 @@ return null; }); + // ── AI Tier selector ──────────────────────────── + // The orchestrator picks the first enabled tier from allowedTiers. + // Showing a dropdown that sets taskOverrides['companion.chat'] + // gives the user fine-grained control per-task without changing + // global settings. + const llmSettings = $derived(llmSettingsState.current); + let currentTier = $derived( + llmSettings.taskOverrides['companion.chat'] ?? 'auto' + ); + + function onTierChange(tier: LlmTier | 'auto') { + const overrides = { ...llmSettings.taskOverrides }; + if (tier === 'auto') { + delete overrides['companion.chat']; + } else { + overrides['companion.chat'] = tier; + } + updateLlmSettings({ taskOverrides: overrides }); + } + + function tierDisplay(tier: LlmTier | 'auto'): string { + if (tier === 'auto') return 'Auto'; + return tierLabel(tier); + } + async function scrollToBottom() { await tick(); messagesEndEl?.scrollIntoView({ behavior: 'smooth' }); @@ -121,6 +153,25 @@
+
+ KI-Modus: + +
+
{#each messages.value as msg (msg.id)}