Commit 6aee50801 for llama.cpp
commit 6aee50801d091f78b3baacd505f5e95d8e8f6838
Author: Aleksander Grygier <aleksander.grygier@gmail.com>
Date: Fri Nov 20 09:58:11 2026 +0100
ui: set the reasoning effort from the model picker (#32632)
* ui: move the reasoning effort into the model picker
The chat form's row no longer holds the reasoning button: the model
picker ends with a Reasoning row, in place of Manage models, that shows
the level in use and opens the levels under it. A phone's model drawer
has the same row. A desktop server with a single model, whose selector
opens the manager instead of a picker, keeps the button beside it.
Assisted-by: Claude (Opus 5.5 Medium)
* ui: show a reasoning effort that is not the default on the model selector
Next to the model on the closed selector, a set level shows as its word,
and reasoning that is off as a small crossed-out lightbulb. At the
default, which leaves it to the model, nothing more shows.
Assisted-by: Claude (Opus 5.5 Medium)
* ui: keep the model picker's footer in place while it opens in Safari
WebKit pins a bottom-sticky element against the scaled box of a parent
that zooms in, so the Reasoning row rode up over the model list until
the opening animation ended. The desktop picker now scrolls its search
and list in a box of their own, with the footer under it.
Assisted-by: Claude (Opus 5.5 Medium)
diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte
index 987c5a350..d71a8da5d 100644
--- a/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte
+++ b/ui/apps/chat/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte
@@ -2,7 +2,6 @@
import { Button } from '@ggml-org/llama-ui/ui/button';
import { SkipForward, Square } from '@lucide/svelte';
import {
- ChatFormActionReasoning,
ChatFormActionRecord,
ChatFormActionsAdd,
ChatFormActionSubmit,
@@ -149,12 +148,12 @@
{/if}
{#if showModelSelector}
- <ChatFormActionReasoning />
-
+ <!-- the reasoning effort sits in the model picker, under the models -->
<ModelsSelector
bind:this={selectorModelRef}
{disabled}
forceForegroundText
+ showReasoning
useGlobalSelection
/>
{/if}
diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelector.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelector.svelte
index 3b24b83a0..7138a07f9 100644
--- a/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelector.svelte
+++ b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelector.svelte
@@ -1,8 +1,11 @@
<script lang="ts">
import ModelLoadHighlight from '../ModelLoadHighlight.svelte';
+ import ModelsSelectorReasoning from './ModelsSelectorReasoning.svelte';
+ import ModelsSelectorReasoningBadge from './ModelsSelectorReasoningBadge.svelte';
import * as Tooltip from '@ggml-org/llama-ui/ui/tooltip';
import { ChevronDown, Loader2 } from '@lucide/svelte';
import {
+ ChatFormActionReasoning,
ModelId,
ModelsSelectorDrawer,
ModelsSelectorDropdown,
@@ -34,6 +37,8 @@
disabled?: boolean;
forceForegroundText?: boolean;
onModelChange?: (modelId: string, modelName: string) => Promise<boolean> | boolean | void;
+ /** The chat's reasoning effort at the foot of the picker (the chat form's selector). */
+ showReasoning?: boolean;
useGlobalSelection?: boolean;
}
@@ -42,6 +47,7 @@
disabled = false,
forceForegroundText = false,
onModelChange,
+ showReasoning = false,
useGlobalSelection = false
}: Props = $props();
@@ -229,6 +235,11 @@
hideQuantization
modelId={selectedOption.model}
/>
+
+ <!-- in the model's column: the trigger is a grid of icon, model and chevron -->
+ {#if showReasoning}
+ <ModelsSelectorReasoningBadge />
+ {/if}
{:else}
<span class="min-w-0 font-medium">Select model</span>
{/if}
@@ -268,6 +279,10 @@
/>
{/snippet}
+{#snippet reasoningFooter()}
+ <ModelsSelectorReasoning variant="list" />
+{/snippet}
+
{#snippet pickerList(listClass: string)}
<div class={['models-list', listClass]}>
{#if !ms.isCurrentModelInCache && displayModel}
@@ -341,6 +356,7 @@
<ModelsSelectorDrawer
bind:open={isOpen}
emptyMessage={ms.emptyMessage}
+ footer={showReasoning ? reasoningFooter : undefined}
isEmpty={ms.isEmpty && ms.isCurrentModelInCache}
onOpenChange={ms.handleOpenChange}
onSearchChange={(v) => ms.setSearchTerm(v)}
@@ -360,6 +376,7 @@
onModelKeyAction={(id, unload) => void handleModelKeyAction(id, unload)}
onSearchKeyDown={handleSearchKeyDown}
{showOrgName}
+ {showReasoning}
/>
{/if}
{:else if isMobile}
@@ -378,6 +395,7 @@
<ModelsSelectorDrawer
bind:open={isOpen}
emptyMessage={ms.emptyMessage}
+ footer={showReasoning ? reasoningFooter : undefined}
isEmpty={ms.isEmpty && ms.isCurrentModelInCache}
onOpenChange={ms.handleOpenChange}
onSearchChange={(v) => ms.setSearchTerm(v)}
@@ -434,4 +452,9 @@
{/snippet}
</Tooltip.Trigger>
</Tooltip.Root>
+
+ <!-- a lone model has no picker to hold the reasoning effort: it keeps its own button -->
+ {#if showReasoning}
+ <ChatFormActionReasoning />
+ {/if}
{/if}
diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorDropdown.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorDropdown.svelte
index 7372f366a..aef7b0883 100644
--- a/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorDropdown.svelte
+++ b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorDropdown.svelte
@@ -1,5 +1,7 @@
<script lang="ts">
import ModelLoadHighlight from '../ModelLoadHighlight.svelte';
+ import ModelsSelectorReasoning from './ModelsSelectorReasoning.svelte';
+ import ModelsSelectorReasoningBadge from './ModelsSelectorReasoningBadge.svelte';
import * as DropdownMenu from '@ggml-org/llama-ui/ui/dropdown-menu';
import * as Tooltip from '@ggml-org/llama-ui/ui/tooltip';
import { ChevronDown, Loader2 } from '@lucide/svelte';
@@ -33,6 +35,8 @@
onManageModels?: () => void;
onModelKeyAction?: (modelId: string, unload: boolean) => void;
onSearchKeyDown?: (event: KeyboardEvent) => void;
+ /** The chat's reasoning effort in place of the manager entry at the foot. */
+ showReasoning?: boolean;
}
let {
@@ -45,7 +49,8 @@
onModelKeyAction,
onSearchKeyDown,
open = $bindable(false),
- showOrgName = true
+ showOrgName = true,
+ showReasoning = false
}: Props = $props();
const selectedOption = $derived(ms.getDisplayOption());
@@ -107,6 +112,11 @@
hideQuantization
modelId={selectedOption.model}
/>
+
+ <!-- in the model's column: the trigger is a grid of icon, model and chevron -->
+ {#if showReasoning}
+ <ModelsSelectorReasoningBadge />
+ {/if}
{:else}
<span class="min-w-0 font-medium">Select model</span>
{/if}
@@ -178,7 +188,7 @@
<!-- the details drawer opens over the menu: the menu stays open under its backdrop -->
<DropdownMenu.Content
align="end"
- class="w-full md:min-w-80 md:w-md max-w-[calc(100vw-2rem)] p-0! max-h-[min(40rem,calc(var(--bits-dropdown-menu-content-available-height)-1rem))]"
+ class="flex w-full flex-col overflow-hidden md:min-w-80 md:w-md max-w-[calc(100vw-2rem)] p-0! max-h-[min(40rem,calc(var(--bits-dropdown-menu-content-available-height)-1rem))]"
data-under-details={uiStore.isModelDetailsOpen || undefined}
onCloseAutoFocus={(event) => {
// bits-ui re-mounts the focus scope when the drawer opens or closes, so this runs with the menu still open; trigger focus would show its tooltip
@@ -194,30 +204,36 @@
>
<DropdownMenuSearchable
emptyMessage={ms.emptyMessage}
- footer={uiStore.isModelsManagerShown ? manageModelsFooter : undefined}
+ footer={showReasoning || uiStore.isModelsManagerShown ? pickerFooter : undefined}
isEmpty={ms.isEmpty && ms.isCurrentModelInCache}
onSearchChange={(v) => ms.setSearchTerm(v)}
{onSearchKeyDown}
placeholder="Search models..."
+ scrollport
searchClass="bg-transparent"
searchValue={ms.searchTerm}
>
- <!-- Option list; the search header sticks to the top and the actions
- footer to the bottom of the content scrollport. -->
+ <!-- Option list; the search header sticks to the top of the list's scrollport, and
+ the footer stays under it. -->
{@render pickerContent('px-1.5')}
</DropdownMenuSearchable>
</DropdownMenu.Content>
</DropdownMenu.Root>
-<!-- the way into the full manager, so it hides with the manager's other entry points -->
-{#snippet manageModelsFooter()}
- <DropdownMenu.Group class="px-2">
- <DropdownMenu.Item class="gap-2" onSelect={handleManageModels}>
- <MODEL_ICON class="size-icon-md shrink-0 text-muted-foreground" />
+<!-- the reasoning effort when the model has one; otherwise the way into the full manager, which hides with the
+manager's other entry points -->
+{#snippet pickerFooter()}
+ {#if showReasoning}
+ <ModelsSelectorReasoning />
+ {:else}
+ <DropdownMenu.Group class="px-2">
+ <DropdownMenu.Item class="gap-2" onSelect={handleManageModels}>
+ <MODEL_ICON class="size-icon-md shrink-0 text-muted-foreground" />
- Manage models
- </DropdownMenu.Item>
- </DropdownMenu.Group>
+ Manage models
+ </DropdownMenu.Item>
+ </DropdownMenu.Group>
+ {/if}
{/snippet}
{#snippet pickerContent(listClass: string)}
diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorReasoning.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorReasoning.svelte
new file mode 100644
index 000000000..b2e829073
--- /dev/null
+++ b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorReasoning.svelte
@@ -0,0 +1,87 @@
+<!--
+ The chat's reasoning effort, at the foot of the model picker: one row with the level in use, which opens the levels
+ under it, sliding open and shut (CollapsibleSection). `menu` is the desktop dropdown's (its rows are menu items),
+ `list` the phone drawer's.
+-->
+<script lang="ts">
+ import * as DropdownMenu from '@ggml-org/llama-ui/ui/dropdown-menu';
+ import { Check, Lightbulb, LightbulbOff } from '@lucide/svelte';
+ import { CollapsibleSection } from '#lib/components/app/index.ts';
+ import { ICON_CLASS_DEFAULT, REASONING_EFFORT_LABELS } from '#lib/constants/index.ts';
+ import { useReasoningMenu } from '#lib/hooks/use-reasoning-menu.svelte.ts';
+ import type { ReasoningEffortLevel } from '#lib/types/index.ts';
+
+ interface Props {
+ variant?: 'menu' | 'list';
+ }
+
+ let { variant = 'menu' }: Props = $props();
+
+ const reasoning = useReasoningMenu();
+
+ let current = $derived(REASONING_EFFORT_LABELS[reasoning.currentEffort]);
+</script>
+
+{#snippet header()}
+ {#if reasoning.isOff}
+ <LightbulbOff class="size-icon-md shrink-0 text-muted-foreground" />
+ {:else}
+ <Lightbulb class="size-icon-md shrink-0 text-muted-foreground" />
+ {/if}
+
+ <span class="flex-1">Reasoning</span>
+
+ <span class="text-xs text-muted-foreground">{current}</span>
+{/snippet}
+
+{#snippet levelLabel(level: ReasoningEffortLevel)}
+ {@const tokenLabel = reasoning.tokenLabel(level)}
+
+ {#if reasoning.isSelected(level)}
+ <Check class="{ICON_CLASS_DEFAULT} shrink-0 text-foreground" />
+ {:else}
+ <div class="{ICON_CLASS_DEFAULT} shrink-0"></div>
+ {/if}
+
+ <span class="min-w-0 flex-1 truncate">{level.label}</span>
+
+ {#if tokenLabel}
+ <span class="shrink-0 text-[11px] text-muted-foreground opacity-60">{tokenLabel}</span>
+ {/if}
+{/snippet}
+
+{#if variant === 'menu'}
+ <DropdownMenu.Group class="px-2" data-slot="models-selector-reasoning">
+ <!-- its row is a menu item that opens the levels without closing the menu -->
+ <CollapsibleSection defaultOpen={false} inMenu trigger={header}>
+ <div class="flex flex-col">
+ {#each reasoning.levels as level (level.value)}
+ <DropdownMenu.Item class="gap-3 pl-4" onSelect={() => reasoning.select(level)}>
+ {@render levelLabel(level)}
+ </DropdownMenu.Item>
+ {/each}
+ </div>
+ </CollapsibleSection>
+ </DropdownMenu.Group>
+{:else}
+ <div class="flex flex-col px-2 pt-1" data-slot="models-selector-reasoning">
+ <CollapsibleSection
+ defaultOpen={false}
+ trigger={header}
+ triggerClass="flex min-h-11 w-full cursor-pointer items-center gap-2 rounded-md px-3 text-left text-sm transition-colors hover:bg-accent"
+ >
+ <div class="flex flex-col">
+ {#each reasoning.levels as level (level.value)}
+ <button
+ aria-pressed={reasoning.isSelected(level)}
+ class="flex min-h-11 w-full cursor-pointer items-center gap-3 rounded-md pr-3 pl-6 text-left text-sm transition-colors hover:bg-accent"
+ onclick={() => reasoning.select(level)}
+ type="button"
+ >
+ {@render levelLabel(level)}
+ </button>
+ {/each}
+ </div>
+ </CollapsibleSection>
+ </div>
+{/if}
diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorReasoningBadge.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorReasoningBadge.svelte
new file mode 100644
index 000000000..fabc65c54
--- /dev/null
+++ b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorReasoningBadge.svelte
@@ -0,0 +1,34 @@
+<!--
+ The chat's reasoning effort on the closed model selector, next to the model: the level as a word when it is set to
+ one, a crossed-out lightbulb when reasoning is off, and nothing at the default, which leaves it to the model.
+-->
+<script lang="ts">
+ import { LightbulbOff } from '@lucide/svelte';
+ import { REASONING_EFFORT_LABELS } from '#lib/constants/index.ts';
+ import { ReasoningEffort } from '#lib/enums/index.ts';
+ import { useReasoningMenu } from '#lib/hooks/use-reasoning-menu.svelte.ts';
+
+ const reasoning = useReasoningMenu();
+</script>
+
+{#if reasoning.isOff}
+ <span
+ class="ml-1 flex shrink-0 items-center text-muted-foreground"
+ data-slot="models-selector-reasoning-badge"
+ title="Reasoning: Off"
+ >
+ <LightbulbOff aria-hidden="true" class="size-icon-xs max-md:size-icon-sm shrink-0" />
+
+ <span class="sr-only">Reasoning off</span>
+ </span>
+{:else if reasoning.currentEffort !== ReasoningEffort.DEFAULT}
+ <span
+ class="ml-1 shrink-0 text-muted-foreground"
+ data-slot="models-selector-reasoning-badge"
+ title="Reasoning: {REASONING_EFFORT_LABELS[reasoning.currentEffort]}"
+ >
+ <span aria-hidden="true">{REASONING_EFFORT_LABELS[reasoning.currentEffort]}</span>
+
+ <span class="sr-only">Reasoning {REASONING_EFFORT_LABELS[reasoning.currentEffort]}</span>
+ </span>
+{/if}
diff --git a/ui/apps/chat/src/lib/components/app/navigation/DropdownMenuSearchable.svelte b/ui/apps/chat/src/lib/components/app/navigation/DropdownMenuSearchable.svelte
index 4bfccbc91..bc652d811 100644
--- a/ui/apps/chat/src/lib/components/app/navigation/DropdownMenuSearchable.svelte
+++ b/ui/apps/chat/src/lib/components/app/navigation/DropdownMenuSearchable.svelte
@@ -18,10 +18,18 @@
searchClass?: string;
children: Snippet;
/**
- * Optional sticky footer: it sticks to the bottom of DropdownMenu.Content's own
- * scrollport, which must stay the scroll container (overflow-y-auto + max-height).
+ * Optional footer. By default it sticks to the bottom of the parent's scrollport
+ * (overflow-y-auto + max-height), see `scrollport`.
*/
footer?: Snippet;
+ /**
+ * Scroll the header and the list in a box of their own, with the footer under it
+ * instead of sticking. For a parent that scales as it opens (a dropdown's zoom-in):
+ * WebKit pins a bottom-sticky element against the scaled box, so the footer would
+ * ride up the list until the animation ends. The parent is then a flex column that
+ * does not scroll itself (flex flex-col overflow-hidden + max-height).
+ */
+ scrollport?: boolean;
}
let {
@@ -34,6 +42,7 @@
onSearchChange,
onSearchKeyDown,
placeholder = 'Search...',
+ scrollport = false,
searchClass = '',
searchValue = $bindable('')
}: Props = $props();
@@ -42,32 +51,42 @@
let stickyHeaderHeight = $state(0);
</script>
-<div
- bind:clientHeight={stickyHeaderHeight}
- class={cn('sticky top-0 z-20 bg-popover p-1.5', headerClass)}
->
- <SearchInput
- bind:value={searchValue}
- class={searchClass}
- onInput={onSearchChange}
- onKeyDown={onSearchKeyDown}
- {placeholder}
- />
-</div>
+{#snippet body()}
+ <div
+ bind:clientHeight={stickyHeaderHeight}
+ class={cn('sticky top-0 z-20 bg-popover p-1.5', headerClass)}
+ >
+ <SearchInput
+ bind:value={searchValue}
+ class={searchClass}
+ onInput={onSearchChange}
+ onKeyDown={onSearchKeyDown}
+ {placeholder}
+ />
+ </div>
+
+ <div class={contentClass}>
+ <!-- wrapper carries the sticky offset: bits-ui owns the style of the scrollport -->
+ <div style="--dropdown-sticky-height: {stickyHeaderHeight}px">
+ {@render children()}
-<div class={contentClass}>
- <!-- wrapper carries the sticky offset: bits-ui owns the style of the scrollport -->
- <div style="--dropdown-sticky-height: {stickyHeaderHeight}px">
- {@render children()}
+ {#if isEmpty}
+ <div class="px-2 py-3 text-center text-sm text-muted-foreground">{emptyMessage}</div>
+ {/if}
+ </div>
+ </div>
+{/snippet}
- {#if isEmpty}
- <div class="px-2 py-3 text-center text-sm text-muted-foreground">{emptyMessage}</div>
- {/if}
+{#if scrollport}
+ <div class="min-h-0 flex-1 overflow-x-hidden overflow-y-auto">
+ {@render body()}
</div>
-</div>
+{:else}
+ {@render body()}
+{/if}
{#if footer}
- <div class="sticky bottom-0 z-20 bg-popover py-1.5">
+ <div class={['z-20 bg-popover py-1.5', scrollport ? 'shrink-0' : 'sticky bottom-0']}>
<div
aria-orientation="horizontal"
class="h-px bg-border/20 mb-1.5 mx-1.5"