2 import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';
3 import { Lightbulb, LightbulbOff, Check, Info } from '@lucide/svelte';
4 import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
5 import * as Tooltip from '$lib/components/ui/tooltip';
6 import { useReasoningMenu } from '$lib/hooks/use-reasoning-menu.svelte';
8 let subOpen = $state(false);
10 const reasoning = useReasoningMenu();
13 {#if reasoning.modelSupportsThinking}
14 <DropdownMenu.Sub bind:open={subOpen}>
15 <DropdownMenu.SubTrigger class="flex cursor-pointer items-center gap-2">
16 {#if reasoning.thinkingEnabled}
17 <Lightbulb class="{ICON_CLASS_DEFAULT} shrink-0 text-amber-400" />
19 <LightbulbOff class="{ICON_CLASS_DEFAULT} shrink-0 text-muted-foreground" />
23 class="text-sm inline-flex gap-2 {!reasoning.thinkingEnabled
24 ? 'text-muted-foreground'
29 <span class="capitalize text-muted-foreground">
30 {reasoning.thinkingEnabled ? reasoning.currentEffort : 'off'}
33 </DropdownMenu.SubTrigger>
35 <DropdownMenu.SubContent
36 class="w-60 bg-popover p-1.5 text-popover-foreground shadow-md outline-none"
38 {#each reasoning.levels as level (level.value)}
39 {@const tokenLabel = reasoning.tokenLabel(level)}
42 class="flex w-full cursor-pointer items-center gap-3 rounded-md px-2 py-1.75 text-left text-sm transition-colors hover:bg-accent"
43 class:bg-accent={reasoning.isSelected(level)}
45 reasoning.select(level);
49 {#if reasoning.isSelected(level)}
50 <Check class="{ICON_CLASS_DEFAULT} shrink-0 text-foreground" />
52 <div class="{ICON_CLASS_DEFAULT} shrink-0"></div>
55 <span class="flex-1">{level.label}</span>
58 <span class="text-[11px] text-muted-foreground opacity-60">
66 <Info class="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
68 <Tooltip.Content side="left">
69 <p>Maximum reasoning effort with extended context usage</p>
75 </DropdownMenu.SubContent>