feat(web): drop "none" from the offered thinking levels (#34)
Co-authored-by: Alice <alice@prismshadow.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
9 files changed
+141
-26
No files matched your search
@@ -64,7 +64,7 @@ import { ProviderLogo } from "../../components/ui/provider-logo";
|
||||
import { hasConfiguredKey, sameModelRef, visibleChatModels } from "../models/model-grouping";
|
||||
import { filterAgents, matchMention, splitLeadingMention } from "./agent-mentions";
|
||||
import { matchSlash, removeSlashToken } from "./slash-token";
|
||||
import { THINKING_LEVELS, thinkingLevelLabel } from "./thinking-level";
|
||||
import { SELECTABLE_THINKING_LEVELS, thinkingLevelLabel } from "./thinking-level";
|
||||
import {
|
||||
BOOK_ICON,
|
||||
buildSkillsMessage,
|
||||
@@ -393,8 +393,10 @@ const SPARK_ICON = "M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12
|
||||
* level straight through to the Agent settings — llmConfig is assembled once per session, so
|
||||
* the level applies to the session created on first send and becomes the Agent's new default
|
||||
* (switch-becomes-default). Per review: a title bar names the control, and the menu lists
|
||||
* exactly the five levels with short names only (no descriptions, no "default" row) — an
|
||||
* Agent without an explicit override shows an em dash until a level is picked.
|
||||
* the selectable levels with short names only (no descriptions, no "default" row, and no
|
||||
* "none" — many models cannot disable thinking); an Agent without an explicit override shows
|
||||
* an em dash until a level is picked, and a stored legacy "none" still displays via the
|
||||
* label table (just never offered).
|
||||
*/
|
||||
function ThinkingLevelSelect({
|
||||
value,
|
||||
@@ -449,7 +451,7 @@ function ThinkingLevelSelect({
|
||||
<div className="border-b border-gray-100 px-3 pb-1.5 pt-0.5 text-xs font-semibold text-gray-500 dark:border-gray-800 dark:text-gray-400">
|
||||
{S.chat.thinkingLevel}
|
||||
</div>
|
||||
{THINKING_LEVELS.map((level) => (
|
||||
{SELECTABLE_THINKING_LEVELS.map((level) => (
|
||||
<button
|
||||
key={level}
|
||||
type="button"
|
||||
|
||||
@@ -5,18 +5,29 @@
|
||||
* it shows the selected Agent's current level and writes a picked level straight through
|
||||
* to the Agent config, so the session created on first send — which reads systemConfig
|
||||
* fresh — runs with it, and it becomes the Agent's new default (switch-becomes-default).
|
||||
* Per review: the menu lists exactly the five levels with short names only (no
|
||||
* descriptions, no "default" row) under a title bar naming the control.
|
||||
* Per review: the menu lists the levels with short names only (no descriptions, no
|
||||
* "default" row) under a title bar naming the control — and it does **not** offer "none"
|
||||
* (many models cannot disable thinking): "none" stays a valid stored/wire value, so a
|
||||
* legacy config or session that carries it still displays via the label table below.
|
||||
*/
|
||||
|
||||
/** The five levels, in menu order (mirrors core's ThinkingLevelName). */
|
||||
/** All five stored/wire levels, for display lookup (mirrors core's ThinkingLevelName). */
|
||||
export const THINKING_LEVELS = ["none", "low", "medium", "high", "xhigh"] as const;
|
||||
|
||||
/**
|
||||
* The levels the picker offers, in menu order: "none" is deliberately excluded (many models
|
||||
* don't support disabling thinking) — it can still be displayed (a stored legacy value) but
|
||||
* never picked.
|
||||
*/
|
||||
export const SELECTABLE_THINKING_LEVELS = ["low", "medium", "high", "xhigh"] as const;
|
||||
|
||||
/**
|
||||
* Short display label for a level from the localized name table (S.chat.thinkingLevelNames).
|
||||
* Returns null for anything outside the five levels — including "" (an Agent without an
|
||||
* explicit override) and session_meta's "default" — so callers can render a placeholder on
|
||||
* the trigger and hide the session read-only tag instead of showing a raw internal value.
|
||||
* Covers all five stored levels including "none" (so a legacy value displays sanely instead
|
||||
* of being rewritten or hidden). Returns null for anything else — including "" (an Agent
|
||||
* without an explicit override) and session_meta's "default" — so callers can render a
|
||||
* placeholder on the trigger and hide the session read-only tag instead of showing a raw
|
||||
* internal value.
|
||||
*/
|
||||
export function thinkingLevelLabel(
|
||||
names: Readonly<Record<string, string>>,
|
||||
@@ -26,3 +37,46 @@ export function thinkingLevelLabel(
|
||||
? (names[level] ?? level)
|
||||
: null;
|
||||
}
|
||||
|
||||
/** One dropdown row of the agent-settings thinking-level menu (shape of OptionMenuChoice<string>). */
|
||||
export interface ThinkingLevelOptionRow {
|
||||
value: string;
|
||||
/** Compact text on the trigger button ("" renders the localized default tag). */
|
||||
triggerLabel: string;
|
||||
/** Panel row title. */
|
||||
label: string;
|
||||
/** Panel row description. */
|
||||
description: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assembles the agent-settings thinking-level dropdown rows from the dictionary's
|
||||
* [value, description] pairs (which no longer include `none`). Backward compatibility:
|
||||
* when the **persisted** config already stores `none` (a legacy value), a display-only
|
||||
* row for it is appended — the trigger shows the real stored state instead of "—" and
|
||||
* nothing is silently rewritten. Gating on the persisted value (not the local edit
|
||||
* state) means a misclick onto another tier keeps the row until the change is actually
|
||||
* saved, so the user can always click back to the value still stored on disk.
|
||||
*/
|
||||
export function thinkingLevelOptionsFor(
|
||||
options: ReadonlyArray<readonly [string, string]>,
|
||||
defaultTag: string,
|
||||
noneKeptDescription: string,
|
||||
storedLevel: string | undefined,
|
||||
): ThinkingLevelOptionRow[] {
|
||||
const rows = options.map(([value, description]) => ({
|
||||
value,
|
||||
triggerLabel: value || defaultTag,
|
||||
label: value || defaultTag,
|
||||
description,
|
||||
}));
|
||||
if (storedLevel === "none") {
|
||||
rows.push({
|
||||
value: "none",
|
||||
triggerLabel: "none",
|
||||
label: "none",
|
||||
description: noneKeptDescription,
|
||||
});
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
Reference in new issue
Block a user