diff --git a/e2e/agentCycleEffort.spec.ts b/e2e/agentCycleEffort.spec.ts index 55fc57129..2938a0698 100644 --- a/e2e/agentCycleEffort.spec.ts +++ b/e2e/agentCycleEffort.spec.ts @@ -285,7 +285,7 @@ async function expectNoSubmission(page: Page) { } for (const surface of ["new", "task"] as const) { - test(`${surface}: configure another model from its row, then edit its context from the composer`, async ({ + test(`${surface}: switch models from the list, then set effort and context from the settings chip`, async ({ workbench: page, }) => { const context = option( @@ -306,22 +306,16 @@ for (const surface of ["new", "task"] as const) { await modelButton(page).click(); const row = page.getByRole("option", { name: /^Swift\b/ }); await row.hover(); - const configure = row.getByRole("button", { name: "Configure Swift…" }); - if (surface === "task") await configure.press("Enter"); - else await configure.click(); - await expect(modelButton(page)).toHaveText("Atlas"); - await expect(page.getByRole("radio", { name: "Gentle" })).toHaveCount(0); - await page.getByRole("radio", { name: "Thorough" }).click(); + await expect(row.getByRole("button", { name: /^Configure/ })).toHaveCount(0); + if (surface === "task") await row.press("Enter"); + else await row.click(); await expect(modelButton(page)).toHaveText("Swift"); - await expect(page.getByRole("radio", { name: "Thorough" })).toBeChecked(); - await page.keyboard.press("Escape"); const settings = page.getByRole("button", { name: /^Model settings:/ }); - await expect(settings).toHaveText("Thorough · 200K"); await settings.click(); + await expect(page.getByRole("button", { name: "Back to models" })).toHaveCount(0); + await page.getByRole("radio", { name: "Thorough" }).click(); await page.getByRole("radio", { name: "1M" }).click(); await expect(settings).toHaveText("Thorough · 1M"); - await page.getByRole("button", { name: "Back to models" }).click(); - await expect(page.getByRole("listbox", { name: "Model", exact: true })).toBeVisible(); await page.keyboard.press("Escape"); await expect(box(page)).toHaveText("Review the project structure"); await expectNoSubmission(page); @@ -642,7 +636,7 @@ test("New Task discovers uncached model effort before the first prompt", async ( await expect .poll(async () => (await ipcCalls(page, "agent_refresh_models")).filter((call) => call.model === "swift")) .toEqual([{ provider: provider.id, force: false, model: "swift" }]); - await expect(page.getByRole("status").filter({ hasText: "Loading model settings…" })).toBeVisible(); + await expect(page.getByRole("status", { name: "Loading model settings…" })).toBeVisible(); await expect(effortLabel(page)).toHaveCount(0); await page.screenshot({ path: testInfo.outputPath("model-settings-loading.png") }); await page.evaluate(() => document.dispatchEvent(new Event("test:model-settings-ready"))); @@ -671,7 +665,7 @@ test("an existing chat can choose effort for a refreshed model before sending", await page.getByRole("button", { name: "Refresh models", exact: true }).click(); await swiftModel.click(); - const loading = page.getByRole("status").filter({ hasText: "Loading model settings…" }); + const loading = page.getByRole("status", { name: "Loading model settings…" }); const send = page.getByRole("button", { name: "Send", exact: true }); await expect(loading).toBeVisible(); await expect(send).toBeDisabled(); diff --git a/src/features/agents/Composer.module.css b/src/features/agents/Composer.module.css index 4e5a6d339..b531e46a3 100644 --- a/src/features/agents/Composer.module.css +++ b/src/features/agents/Composer.module.css @@ -121,10 +121,6 @@ .modelControl { align-items: center; } -.modelDetail { - box-shadow: inset 1px 0 var(--border); - color: var(--fg-muted); -} .configPicker > button { max-width: 100%; } @@ -164,6 +160,11 @@ white-space: nowrap; transition: background var(--dur-fast) var(--ease); } +.chip.chipLoading, +.chip.chipLoading:hover { + color: var(--fg-muted); + background: none; +} .chip:hover, .chip[aria-expanded="true"] { background: var(--bg-toolbar-hover); @@ -233,16 +234,6 @@ gap: var(--space-3); padding: 4px 12px 10px; } -.modelSettingsHeader { - display: flex; - align-items: center; - gap: var(--space-2); -} -.modelSettingsHeader strong { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} .quickRow { display: flex; flex-direction: column; @@ -258,8 +249,7 @@ } .modelEffortPopup [role="option"]:hover .modelRowConfigure, .modelEffortPopup [role="option"][aria-selected="true"] .modelRowConfigure, -.modelEffortPopup [role="option"]:focus-within .modelRowConfigure, -.modelEffortPopup [role="option"] .currentRowSettings { +.modelEffortPopup [role="option"]:focus-within .modelRowConfigure { opacity: 1; } .modelRowConfigure { @@ -274,23 +264,6 @@ color: var(--fg-muted); cursor: pointer; } -.modelRowSettings { - display: inline-flex; - align-items: center; - gap: var(--space-0-5); - width: auto; - max-width: 120px; - padding-inline: 4px; - font-size: var(--fs-small); -} -.modelRowSettings span { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} -.modelRowSettings svg { - flex: none; -} .modelRowConfigure:hover, .modelRowConfigure:focus-visible { outline: none; diff --git a/src/features/agents/ConfigPickers.test.tsx b/src/features/agents/ConfigPickers.test.tsx index beffbc09a..118d7e336 100644 --- a/src/features/agents/ConfigPickers.test.tsx +++ b/src/features/agents/ConfigPickers.test.tsx @@ -350,7 +350,7 @@ describe("model settings", () => { expect(onChange).toHaveBeenCalledExactlyOnceWith("reasoning_effort", "xhigh"); }); - it("offers more effort levels than fit the segmented control as a dropdown", () => { + it("lists more effort levels than fit the segmented control, one click away", () => { const onChange = vi.fn(); const config = copilotConfig().map((o) => o.category === "thought_level" @@ -367,9 +367,13 @@ describe("model settings", () => { fireEvent.click(screen.getByRole("button", { name: "Model settings: Max" })); const dialog = screen.getByRole("dialog", { name: "Model settings" }); expect(within(dialog).queryByRole("radiogroup", { name: "Effort Level" })).not.toBeInTheDocument(); - fireEvent.click(within(dialog).getByRole("button", { name: /Reasoning Effort/ })); - fireEvent.click(screen.getByRole("option", { name: /Extra high/ })); - expect(onChange).toHaveBeenCalledWith("reasoning_effort", "extra-high"); + expect(within(dialog).queryByRole("button", { name: /Reasoning Effort/ })).not.toBeInTheDocument(); + const levels = within(dialog).getByRole("listbox", { name: "Effort Level" }); + expect(within(levels).getByRole("option", { name: /Max/ })).toHaveAttribute("aria-selected", "true"); + fireEvent.click(within(levels).getByRole("option", { name: /Extra high/ })); + expect(onChange).toHaveBeenCalledExactlyOnceWith("reasoning_effort", "extra-high"); + // The only setting: choosing it is done. + expect(screen.queryByRole("dialog", { name: "Model settings" })).not.toBeInTheDocument(); }); it("tucks Fast into the model popup", () => { @@ -392,7 +396,7 @@ describe("model settings", () => { expect(within(dialog).getByRole("switch", { name: "Fast" })).toHaveAttribute("aria-checked", "false"); }); - it("opens settings from the selected row without choosing it and returns to a pinnable model list", () => { + it("keeps the model list to models and the settings chip to every model setting", () => { const onChange = vi.fn(); const cfg = copilotConfig().map((o) => o.id === "model" @@ -417,32 +421,35 @@ describe("model settings", () => { render(); const model = screen.getByRole("button", { name: "Model" }); expect(model).toHaveTextContent("Claude Sonnet 5.5"); - expect(screen.getByRole("button", { name: /^Model settings:/ })).toHaveTextContent("medium · 1M"); + const settings = screen.getByRole("button", { name: /^Model settings:/ }); + expect(settings).toHaveTextContent("medium · 1M"); fireEvent.click(model); - const dialog = screen.getByRole("dialog", { name: "Model" }); - expect(within(dialog).queryByText("Balanced")).not.toBeInTheDocument(); - expect(within(dialog).getByText("Medium cost")).toBeVisible(); - expect(within(dialog).queryByRole("radio")).not.toBeInTheDocument(); - fireEvent.click(within(dialog).getByRole("button", { name: "Configure Claude Sonnet 5.5…" })); - expect(onChange).not.toHaveBeenCalled(); + const models = screen.getByRole("dialog", { name: "Model" }); + expect(within(models).queryByText("Balanced")).not.toBeInTheDocument(); + expect(within(models).getByText("Medium cost")).toBeVisible(); + expect(within(models).queryByRole("radio")).not.toBeInTheDocument(); + expect(within(models).queryByRole("button", { name: /^Configure/ })).not.toBeInTheDocument(); + fireEvent.click(within(models).getAllByRole("button", { name: "Pin model" })[0]!); + const listbox = within(models).getByRole("listbox", { name: "Model" }); + expect(within(listbox).getByText("Pinned")).toBeVisible(); + expect(within(listbox).getByText("Models")).toBeVisible(); + fireEvent.click(within(models).getByRole("option", { name: /GPT-6 Sol/ })); + expect(onChange).toHaveBeenCalledExactlyOnceWith("model", "gpt-6-sol"); + expect(screen.queryByRole("dialog", { name: "Model" })).not.toBeInTheDocument(); + onChange.mockClear(); + fireEvent.click(settings); + const dialog = screen.getByRole("dialog", { name: "Model settings" }); + expect(within(dialog).queryByRole("button", { name: "Back to models" })).not.toBeInTheDocument(); const effortGroup = within(dialog).getByRole("radiogroup", { name: "Effort Level" }); expect(within(effortGroup).getByRole("radio", { name: "medium" })).toHaveAttribute("aria-checked", "true"); const contextGroup = within(dialog).getByRole("radiogroup", { name: "Context Size" }); expect(within(contextGroup).getByRole("radio", { name: "1M" })).toHaveAttribute("aria-checked", "true"); fireEvent.click(within(contextGroup).getByRole("radio", { name: "200K" })); - expect(onChange).toHaveBeenCalledWith("contextTier", "default"); - - fireEvent.click(within(dialog).getByRole("button", { name: "Back to models" })); - fireEvent.click(within(dialog).getAllByRole("button", { name: "Pin model" })[0]!); - const listbox = within(dialog).getByRole("listbox", { name: "Model" }); - expect(within(listbox).getByText("Pinned")).toBeVisible(); - expect(within(listbox).getByText("Models")).toBeVisible(); - - fireEvent.click(within(dialog).getByRole("option", { name: /GPT-6 Sol/ })); - expect(onChange).toHaveBeenCalledWith("model", "gpt-6-sol"); - expect(screen.queryByRole("dialog", { name: "Model" })).not.toBeInTheDocument(); + expect(onChange).toHaveBeenCalledExactlyOnceWith("contextTier", "default"); + // Several settings: the popup stays for the next one. + expect(screen.getByRole("dialog", { name: "Model settings" })).toBeInTheDocument(); }); it("filters the model list and picks the highlighted model with the keyboard", () => { diff --git a/src/features/agents/ConfigPickers.tsx b/src/features/agents/ConfigPickers.tsx index f3dec7b23..53c0e4a05 100644 --- a/src/features/agents/ConfigPickers.tsx +++ b/src/features/agents/ConfigPickers.tsx @@ -7,6 +7,7 @@ import type { AgentConfigOption } from "@/bindings"; import { useTx } from "@/platform/i18n"; import { Icon, IconButton, Popup, Select, T, Toggle } from "@/ui"; import { SelectListbox, type SelectOption } from "@/ui/Select"; +import { Spinner } from "@/ui/Spinner"; import { isContextOption, mainOptions, modelConfigOptions, modeIcon } from "./composerModel"; import { togglePinnedModel, useAgents } from "./store"; import styles from "./Composer.module.css"; @@ -76,7 +77,7 @@ function switchValues(option: AgentConfigOption): { on: string; off: string } | const selected = (option: AgentConfigOption, value: string | null) => option.values.find((v) => v.value === value) ?? null; -type ChangeOption = (option: string, value: string, forModel?: string) => void; +type ChangeOption = (option: string, value: string) => void; interface ModelRefresh { draft?: boolean; @@ -86,12 +87,6 @@ interface ModelRefresh { error: string | null; onOpen?: () => void; onRefresh: () => void; - preview?: { - /** Undefined until discovery; an empty array means the agent reported no settings. */ - settingsFor: (model: string) => AgentConfigOption[] | undefined; - load: (model: string) => void; - errorFor: (model: string) => string | null | undefined; - }; } export function ConfigPickers({ @@ -168,11 +163,7 @@ export function ConfigPickers({ ) : ( )} - {o === model && modelRefresh?.loadingSettings && ( - - Loading model settings… - - )} + {o === model && !combinedModel && modelRefresh?.loadingSettings && } ))} {secondary.length > 0 && ( @@ -261,8 +252,8 @@ function ConfigPicker({ ); } -/** Effort levels that fit the popup's segmented control; more (Codex has six) get a dropdown. */ -const SEGMENTED_EFFORT_MAX = 5; +/** Values a setting shows as a segmented control; a longer list (Codex has six effort levels) is listed. */ +const SEGMENTED_MAX = 5; function settingName(option: AgentConfigOption) { return option.category === "thought_level" @@ -299,7 +290,8 @@ function ModelPicker({ modelRefresh?: ModelRefresh; }) { const tx = useTx(); - const [page, setPage] = useState<"models" | { model: string | null } | null>(null); + // The model chip picks a model; the settings chip next to it holds the model's settings. + const [open, setOpen] = useState<"models" | "settings" | null>(null); const pinnedModels = useAgents((s) => s.pinnedModels); const anchor = useRef(null); const selectedModel = selected(model, modelValue); @@ -307,15 +299,12 @@ function ModelPicker({ const modelName = unavailable ? tx`${modelValue} (unavailable)` : (selectedModel?.name ?? (modelRefresh ? modelValue : null) ?? tx("Default")); - - const summary = settingsSummary(settings, tx); - const settingsFor = (id: string | null) => - id === modelValue ? settings : id ? modelRefresh?.preview?.settingsFor(id) : undefined; - const details = page && page !== "models" && (page.model === modelValue || selected(model, page.model)) ? page : null; - const inspectedModel = details ? selected(model, details.model) : null; - const openModels = () => { - modelRefresh?.onOpen?.(); - setPage("models"); + const shown = settings.filter((o) => o.values.length > 0); + const summary = settingsSummary(shown, tx); + const toggle = (which: "models" | "settings") => { + if (open === which) return setOpen(null); + if (which === "models") modelRefresh?.onOpen?.(); + setOpen(which); }; return ( @@ -325,46 +314,41 @@ function ModelPicker({ className={styles.chip} aria-label={tx(model.name)} aria-haspopup="dialog" - aria-expanded={!!page && !details} + aria-expanded={open === "models"} title={`${tx(model.name)}: ${modelName}`} - onClick={() => (page && !details ? setPage(null) : openModels())} + onClick={() => toggle("models")} > {modelName} - {summary && !unavailable && ( - + {!unavailable && modelRefresh?.loadingSettings ? ( + + ) : ( + summary && + !unavailable && ( + + ) )} setPage(null)} - aria-label={tx(details ? "Model settings" : "Model")} + onClose={() => setOpen(null)} + aria-label={tx(open === "settings" ? "Model settings" : "Model")} className={styles.modelEffortPopup} > - {details ? ( - { - if (details.model && details.model !== modelValue) onChange(option, value, details.model); - else onChange(option, value); - }} - /> + {open === "settings" ? ( + setOpen(null)} /> ) : ( <> {unavailable && ( @@ -381,16 +365,12 @@ function ModelPicker({ listClassName={styles.modelList} onChoose={(v) => { onChange(model.id, v); - setPage(null); + setOpen(null); }} renderAction={(opt) => { const raw = model.values.find((v) => v.value === opt.value); if (!raw) return null; const pinned = pinnedModels.includes(raw.value); - const rowSettings = settingsFor(raw.value); - const configurable = rowSettings - ? rowSettings.some((o) => o.values.length > 0) - : !!modelRefresh?.preview; return ( <> @@ -404,23 +384,6 @@ function ModelPicker({ > - {configurable && ( - - )} ); }} @@ -438,82 +401,72 @@ function ModelPicker({ ); } +/** + * The current model's settings (effort, context size, fast mode…), each a click away: an on/off + * setting as a switch, a short list as a segmented control, a longer one listed. A model with + * one setting closes on a choice. + */ function ModelSettings({ - id, - name, settings, - modelRefresh, - onBack, onChange, + onDone, }: { - id: string | null; - name: string; - settings: AgentConfigOption[] | undefined; - modelRefresh?: ModelRefresh; - onBack: () => void; + settings: AgentConfigOption[]; onChange: ChangeOption; + onDone: () => void; }) { const tx = useTx(); - const attempted = useRef(false); - const lookup = modelRefresh?.preview; - const refreshing = modelRefresh?.refreshing; - useEffect(() => { - if (!id || settings || !lookup || refreshing || attempted.current) return; - attempted.current = true; - lookup.load(id); - }, [id, settings, lookup, refreshing]); - const loading = modelRefresh?.loadingSettings || (!settings && refreshing); - const error = !settings && id && lookup?.errorFor(id); + const only = settings.length === 1; return (
-
- - {name} -
- {loading ? ( -

- Loading model settings… -

- ) : error ? ( -

{tx`Could not refresh models: ${error}`}

- ) : !settings?.some((o) => o.values.length) ? ( -

- No settings reported for this model. -

- ) : ( - settings - .filter((o) => o.values.length > 0) - .map((o) => { - const label = tx(settingName(o)); - const segmented = - isContextOption(o.id) || (o.category === "thought_level" && o.values.length <= SEGMENTED_EFFORT_MAX); - return ( -
- - {label} - - {segmented ? ( - ({ - value: v.value, - label: v.name, - description: v.description ?? undefined, - }))} - value={settingValue(o)!.value} - onChange={(v) => onChange(o.id, v)} - /> - ) : ( - - )} -
- ); - }) - )} + {settings.map((o) => { + const label = tx(settingName(o)); + const control = switchValues(o) ? ( + + ) : o.values.length <= SEGMENTED_MAX ? ( + ({ value: v.value, label: v.name, description: v.description ?? undefined }))} + value={settingValue(o)!.value} + onChange={(v) => { + onChange(o.id, v); + if (only) onDone(); + }} + /> + ) : ( + ({ value: v.value, label: v.name, detail: v.description ?? undefined }))} + onChoose={(v) => { + onChange(o.id, v); + if (only) onDone(); + }} + /> + ); + return ( +
+ + {label} + + {control} +
+ ); + })}
); } +/** Where the model's settings chip appears once they arrive. */ +function LoadingSettingsChip() { + const tx = useTx(); + return ( + + + + ); +} + function ModelRefreshFooter({ refreshing, retryAtMs, error, onRefresh }: ModelRefresh) { const tx = useTx(); const [now, setNow] = useState(Date.now); diff --git a/src/features/agents/HomeEditor.tsx b/src/features/agents/HomeEditor.tsx index c57cda916..ad4fabc11 100644 --- a/src/features/agents/HomeEditor.tsx +++ b/src/features/agents/HomeEditor.tsx @@ -24,7 +24,6 @@ import { HOME, NO_COMMANDS, draftConfig, - draftModelSettings, refreshProviders, refreshModels, setDraftMcpOverrides, @@ -243,10 +242,7 @@ export function HomeEditor({ docked = false, input }: { docked?: boolean; input? { - if (forModel && model) setDraftOption(model.id, forModel); - setDraftOption(option, value); - }} + onChange={setDraftOption} modelRefresh={ provider?.installed ? { @@ -259,16 +255,6 @@ export function HomeEditor({ docked = false, input }: { docked?: boolean; input? : null, error: !requestingModels && currentModelRequest ? (catalog?.error ?? null) : null, onRefresh: () => void executeAction("agents.refreshModels", null), - preview: { - settingsFor: (id) => - draftModelSettings( - (catalog ?? provider).thoughtLevels?.[id], - draft.thoughtLevels?.[id], - providerDefaults, - ), - load: (id) => void refreshModels(provider.id, false, id), - errorFor: (id) => (requestTarget === id ? catalog?.error : null), - }, } : undefined } diff --git a/src/features/agents/modelRefresh.test.tsx b/src/features/agents/modelRefresh.test.tsx index a15e726a3..86b6584b3 100644 --- a/src/features/agents/modelRefresh.test.tsx +++ b/src/features/agents/modelRefresh.test.tsx @@ -511,7 +511,7 @@ it("discovers an uncached model's own settings before its first task and restore fireEvent.click(screen.getByRole("button", { name: "Model" })); fireEvent.click(screen.getByRole("option", { name: "small" })); await waitFor(() => expect(backend.refresh).toHaveBeenLastCalledWith("first", false, "small")); - expect(screen.getByText("Loading model settings…")).toHaveAttribute("role", "status"); + expect(screen.getByRole("status", { name: "Loading model settings…" })).toBeVisible(); expect(screen.queryByRole("dialog", { name: "Model" })).not.toBeInTheDocument(); expect(backend.create).not.toHaveBeenCalled(); await act(async () => @@ -529,14 +529,14 @@ it("discovers an uncached model's own settings before its first task and restore ), ), ); - expect(screen.queryByText("Loading model settings…")).not.toBeInTheDocument(); + expect(screen.queryByRole("status", { name: "Loading model settings…" })).not.toBeInTheDocument(); const settings = screen.getByRole("button", { name: /^Model settings:/ }); expect(settings).toHaveTextContent("medium"); fireEvent.click(settings); fireEvent.click(screen.getByRole("radio", { name: "max" })); expect(screen.getByRole("radio", { name: "long_context" })).toBeVisible(); fireEvent.click(screen.getByRole("radio", { name: "long_context" })); - fireEvent.click(screen.getByRole("button", { name: "Back to models" })); + fireEvent.click(screen.getByRole("button", { name: "Model" })); fireEvent.click(screen.getByTitle("big")); expect(settings).toHaveTextContent("high"); fireEvent.click(screen.getByRole("button", { name: "Model" })); @@ -562,41 +562,10 @@ it("does not rediscover a model that explicitly reports no per-model controls", fireEvent.click(screen.getByTitle(model)); } expect(backend.refresh).toHaveBeenCalledExactlyOnceWith("first", false, "big"); - expect(screen.queryByText("Loading model settings…")).not.toBeInTheDocument(); + expect(screen.queryByRole("status", { name: "Loading model settings…" })).not.toBeInTheDocument(); expect(screen.queryByRole("button", { name: "Reasoning" })).not.toBeInTheDocument(); }); -it("inspects uncached settings without switching models or borrowing the current model's levels", async () => { - delete backend.providers[0]!.thoughtLevels!.small; - await connect(); - render(); - await waitFor(() => expect(useAgents.getState().modelRequests.size).toBe(0)); - const pending = deferred(); - backend.refresh.mockReturnValueOnce(pending.promise); - fireEvent.click(screen.getByRole("button", { name: "Model" })); - fireEvent.click(screen.getByRole("button", { name: "Configure small…" })); - expect(backend.refresh).toHaveBeenLastCalledWith("first", false, "small"); - expect(screen.getByRole("status")).toHaveTextContent("Loading model settings…"); - expect(screen.queryByRole("radio")).not.toBeInTheDocument(); - await act(async () => - pending.resolve( - ok( - catalog("first", { - thoughtLevels: { - ...catalog().thoughtLevels, - small: [option("effort", "thought_level", ["quick", "thorough"])], - }, - }), - ), - ), - ); - expect(screen.getByRole("radio", { name: "quick" })).toBeVisible(); - fireEvent.click(screen.getByRole("button", { name: "Back to models" })); - expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("big"); - expect(backend.setConfig).not.toHaveBeenCalled(); - expect(backend.create).not.toHaveBeenCalled(); -}); - it("waits for an unrelated lookup and discovers only the latest selected model", async () => { backend.providers[0]!.config = [option("model", "model", ["big", "small", "latest"])]; await connect(); diff --git a/src/features/agents/session/SessionComposer.tsx b/src/features/agents/session/SessionComposer.tsx index 04ee68b60..e465d7416 100644 --- a/src/features/agents/session/SessionComposer.tsx +++ b/src/features/agents/session/SessionComposer.tsx @@ -162,7 +162,6 @@ export function SessionComposer({ const provider = useAgents((s) => s.providers.find((p) => p.id === task.provider)); const catalog = useAgents((s) => s.modelCatalogs.get(task.provider)); const requestingModels = useAgents((s) => s.modelRequests.has(task.provider)); - const requestTarget = useAgents((s) => s.modelRequestTargets.get(task.provider)); const model = task.config.find((o) => o.category === "model"); const catalogModel = (catalog?.config ?? provider?.config)?.find((o) => o.category === "model"); const canRefreshModels = @@ -230,28 +229,17 @@ export function SessionComposer({ ) .finally(() => setSending(false)); }; - const setOption = (id: string, value: string, forModel?: string) => { + const setOption = (id: string, value: string) => { const pickerModel = pickerConfig.find((o) => o.category === "model"); const changingModel = id === pickerModel?.id; - const loadingModel = !!forModel || (changingModel && !model?.values.some((v) => v.value === value)); + const loadingModel = changingModel && !model?.values.some((v) => v.value === value); const pendingModel = model?.current != null && model.current !== task.model; const change = loadingModel || (changingModel && configChange.current) || pendingModel ? { loadingModel } : null; if (change) { configChange.current = change; setConfiguring(change); } - const apply = async () => { - if (forModel && pickerModel) { - await setTaskConfig(task.id, pickerModel.id, forModel); - // A later model choice supersedes both halves of this edit. - const latest = useAgents.getState().tasks.get(task.id); - const selected = latest?.config.find((o) => o.category === "model")?.current ?? latest?.model; - if (configChange.current !== change) return; - if (selected !== forModel) throw new Error(tx("The model changed before its setting could be applied.")); - } - await setTaskConfig(task.id, id, value); - }; - void apply() + void setTaskConfig(task.id, id, value) .catch((e: unknown) => notifications().notify({ level: "error", @@ -333,11 +321,6 @@ export function SessionComposer({ error: requestingModels ? null : (catalog?.error ?? null), onOpen: () => void refreshTaskModels(task.id, false), onRefresh: () => void executeAction("agents.refreshModels", task.id), - preview: { - settingsFor: (id) => (catalog ?? provider)?.thoughtLevels?.[id], - load: (id) => void refreshTaskModels(task.id, false, id), - errorFor: (id) => (requestTarget === id ? catalog?.error : null), - }, } : undefined } diff --git a/src/platform/locales/text/en.json b/src/platform/locales/text/en.json index a23b71fb9..a35f4407a 100644 --- a/src/platform/locales/text/en.json +++ b/src/platform/locales/text/en.json @@ -192,9 +192,6 @@ "Effort Level": "Effort Level", "Model settings": "Model settings", "Model settings: {summary}": "Model settings: {summary}", - "Back to models": "Back to models", - "No settings reported for this model.": "No settings reported for this model.", - "The model changed before its setting could be applied.": "The model changed before its setting could be applied.", "Context Size": "Context Size", "Free": "Free", "Low cost": "Low cost", diff --git a/src/platform/locales/text/tr.json b/src/platform/locales/text/tr.json index 08abc3d0b..e34d5f280 100644 --- a/src/platform/locales/text/tr.json +++ b/src/platform/locales/text/tr.json @@ -175,9 +175,6 @@ "Effort Level": "Düşünme Düzeyi", "Model settings": "Model ayarları", "Model settings: {summary}": "Model ayarları: {summary}", - "Back to models": "Modellere dön", - "No settings reported for this model.": "Bu model için bildirilen ayar bulunmuyor.", - "The model changed before its setting could be applied.": "Ayar uygulanamadan model değişti.", "Context Size": "Bağlam Boyutu", "Free": "Ücretsiz", "Low cost": "Düşük maliyet", diff --git a/src/platform/locales/text/zh-TW.json b/src/platform/locales/text/zh-TW.json index 1ce16f919..840e06405 100644 --- a/src/platform/locales/text/zh-TW.json +++ b/src/platform/locales/text/zh-TW.json @@ -156,9 +156,6 @@ "Effort Level": "思考強度", "Model settings": "模型設定", "Model settings: {summary}": "模型設定:{summary}", - "Back to models": "返回模型清單", - "No settings reported for this model.": "此模型未提供可設定的設定。", - "The model changed before its setting could be applied.": "應用設定前,所選模型已發生變化。", "Context Size": "上下文大小", "Free": "免費", "Low cost": "低開銷", diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index eae276fbf..8c347cdbf 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -158,9 +158,6 @@ "Effort Level": "思考强度", "Model settings": "模型设置", "Model settings: {summary}": "模型设置:{summary}", - "Back to models": "返回模型列表", - "No settings reported for this model.": "此模型未提供可配置的设置。", - "The model changed before its setting could be applied.": "应用设置前,所选模型已发生变化。", "Context Size": "上下文大小", "Free": "免费", "Low cost": "低开销",