mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
feat(agents): colocate effort and context settings (#4382)
Effort moves into the model popup, next to context size and model settings, with the current effort shown on the model chip (Atlas · Gentle), as Codex and Copilot keep it in the model picker. Up to four levels use the segmented control, more (Codex has six) a dropdown row; the chip's effort/context detail stays visible in the narrow composer layout, where the model name truncates first. Co-authored-by: dengliu <5108773+dengliu@users.noreply.github.com>
This commit is contained in:
@@ -219,11 +219,12 @@ function history(page: Page) {
|
||||
function modelButton(page: Page) {
|
||||
return page.getByRole("button", { name: "Model", exact: true }).filter({ visible: true });
|
||||
}
|
||||
function effortButton(page: Page) {
|
||||
return page.getByRole("button", { name: "Reasoning", exact: true }).filter({ visible: true });
|
||||
/** The effort is shown on the model button, after the model's name. */
|
||||
function effortLabel(page: Page) {
|
||||
return modelButton(page).locator("[class*='modelDetail']");
|
||||
}
|
||||
async function expectEffort(page: Page, name: string) {
|
||||
await expect(effortButton(page)).toHaveText(name);
|
||||
await expect(effortLabel(page)).toHaveText(name);
|
||||
}
|
||||
async function selected(box: Locator) {
|
||||
return box.evaluate((element) => {
|
||||
@@ -364,8 +365,8 @@ test("Settings and effort popup exclude the agent shortcut", async ({ workbench:
|
||||
await expect(search).toBeFocused();
|
||||
await expect(search).toHaveValue("keymap");
|
||||
await settings.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
await effortButton(page).click();
|
||||
const popup = page.getByRole("listbox", { name: "Reasoning", exact: true });
|
||||
await modelButton(page).click();
|
||||
const popup = page.getByRole("radiogroup", { name: "Effort Level", exact: true });
|
||||
await expect(popup).toBeVisible();
|
||||
await page.keyboard.press("Alt+t");
|
||||
expect(await ipcCalls(page, "agent_set_config")).toEqual([]);
|
||||
@@ -584,14 +585,16 @@ test("New Task discovers uncached model effort before the first prompt", async (
|
||||
.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(effortButton(page)).toHaveCount(0);
|
||||
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")));
|
||||
await expectEffort(page, "Quick");
|
||||
await effortButton(page).click();
|
||||
await expect(page.getByRole("option", { name: "Quick", exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("option", { name: "Thorough", exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("option", { name: "Gentle", exact: true })).toHaveCount(0);
|
||||
await modelButton(page).click();
|
||||
const efforts = page.getByRole("radiogroup", { name: "Effort Level", exact: true });
|
||||
await expect(efforts.getByRole("radio", { name: "Quick", exact: true })).toBeVisible();
|
||||
await expect(efforts.getByRole("radio", { name: "Thorough", exact: true })).toBeVisible();
|
||||
await expect(efforts.getByRole("radio", { name: "Gentle", exact: true })).toHaveCount(0);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(box(page)).toHaveText("Keep this first task unsent");
|
||||
await expectNoSubmission(page);
|
||||
expect(await ipcCalls(page, "agent_set_config")).toEqual([]);
|
||||
|
||||
@@ -239,7 +239,7 @@
|
||||
}
|
||||
.quickLabel {
|
||||
flex: none;
|
||||
width: 52px;
|
||||
width: 72px;
|
||||
color: var(--fg-muted);
|
||||
font-size: var(--fs-small);
|
||||
}
|
||||
@@ -401,10 +401,14 @@
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* The effort is in the model popup: the button keeps the model's name readable. */
|
||||
.chipDetail {
|
||||
/* Details give way to the names, except the model's effort and context: the model's
|
||||
name truncates first, since they are only shown here. */
|
||||
.chipDetail:not(.modelDetail) {
|
||||
display: none;
|
||||
}
|
||||
.modelDetail {
|
||||
flex: none;
|
||||
}
|
||||
.inlineSetting {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ it("edits secondary settings from the compact popup and restores focus when dism
|
||||
expect(trigger).toHaveFocus();
|
||||
});
|
||||
|
||||
describe("model and effort button", () => {
|
||||
describe("model settings", () => {
|
||||
const copilotConfig = (effortLevels: string[] | null = ["low", "medium", "high", "xhigh"]): AgentConfigOption[] => [
|
||||
{
|
||||
id: "model",
|
||||
@@ -314,18 +314,66 @@ describe("model and effort button", () => {
|
||||
},
|
||||
];
|
||||
|
||||
it("shows the effort as its own picker beside the model, and the mode with Allow All", () => {
|
||||
it("keeps effort as a standalone setting when no model is available", () => {
|
||||
render(
|
||||
<ConfigPickers
|
||||
config={[
|
||||
{
|
||||
id: "reasoning_effort",
|
||||
name: "Reasoning Effort",
|
||||
category: "thought_level",
|
||||
description: null,
|
||||
current: "medium",
|
||||
via: "option",
|
||||
values: [value("low"), value("medium")],
|
||||
},
|
||||
]}
|
||||
onChange={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
expect(screen.getByRole("button", { name: "Reasoning Effort" })).toHaveTextContent("medium");
|
||||
expect(screen.queryByRole("button", { name: "Agent settings" })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("keeps effort with model settings and the mode with Allow All", () => {
|
||||
const onChange = vi.fn();
|
||||
render(<ConfigPickers config={copilotConfig()} onChange={onChange} />);
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("Claude Sonnet 5.5");
|
||||
const model = screen.getByRole("button", { name: "Model" });
|
||||
expect(model).toHaveTextContent("Claude Sonnet 5.5");
|
||||
expect(model).toHaveTextContent("medium");
|
||||
expect(screen.getByRole("button", { name: "Mode" })).toHaveTextContent("AgentAllow All");
|
||||
const effort = screen.getByRole("button", { name: "Reasoning Effort" });
|
||||
expect(effort).toHaveTextContent("medium");
|
||||
fireEvent.click(effort);
|
||||
fireEvent.click(screen.getByRole("option", { name: "XHigh" }));
|
||||
fireEvent.click(model);
|
||||
const dialog = screen.getByRole("dialog", { name: "Model" });
|
||||
const effort = within(dialog).getByRole("radiogroup", { name: "Effort Level" });
|
||||
expect(within(effort).getByRole("radio", { name: "medium" })).toHaveAttribute("aria-checked", "true");
|
||||
fireEvent.click(within(effort).getByRole("radio", { name: "XHigh" }));
|
||||
expect(onChange).toHaveBeenCalledExactlyOnceWith("reasoning_effort", "xhigh");
|
||||
});
|
||||
|
||||
it("offers more effort levels than fit the segmented control as a dropdown", () => {
|
||||
const onChange = vi.fn();
|
||||
const config = copilotConfig().map((o) =>
|
||||
o.category === "thought_level"
|
||||
? {
|
||||
...o,
|
||||
values: ["Low", "Medium", "High", "Extra high", "Max", "Ultra"].map((name) =>
|
||||
value(name.toLowerCase().replace(" ", "-"), name),
|
||||
),
|
||||
current: "max",
|
||||
}
|
||||
: o,
|
||||
);
|
||||
render(<ConfigPickers config={config} onChange={onChange} />);
|
||||
const model = screen.getByRole("button", { name: "Model" });
|
||||
expect(model).toHaveTextContent("Max");
|
||||
fireEvent.click(model);
|
||||
const dialog = screen.getByRole("dialog", { name: "Model" });
|
||||
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");
|
||||
});
|
||||
|
||||
it("tucks Fast into the model popup", () => {
|
||||
const config = [
|
||||
...copilotConfig().filter((o) => o.category !== "thought_level"),
|
||||
@@ -369,13 +417,19 @@ describe("model and effort button", () => {
|
||||
values: [value("default", "200K"), value("long_context", "1M")],
|
||||
});
|
||||
render(<ConfigPickers config={cfg} onChange={onChange} />);
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("Claude Sonnet 5.51M");
|
||||
const model = screen.getByRole("button", { name: "Model" });
|
||||
expect(model).toHaveTextContent("Claude Sonnet 5.5");
|
||||
expect(model).toHaveTextContent("medium");
|
||||
expect(model).toHaveTextContent("1M");
|
||||
expect(model).toHaveAttribute("title", expect.stringContaining("Effort Level: medium · Context Size: 1M"));
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Model" }));
|
||||
fireEvent.click(model);
|
||||
const dialog = screen.getByRole("dialog", { name: "Model" });
|
||||
expect(within(dialog).queryByText("Balanced")).not.toBeInTheDocument();
|
||||
expect(within(dialog).getByText("Medium cost")).toBeVisible();
|
||||
|
||||
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" }));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Model, effort, mode and approvals controls for a composer's bottom row. The model button
|
||||
* opens a searchable model list (pinned models first, context size above it); the effort is
|
||||
* its own picker beside it, one click away.
|
||||
* opens a searchable model list (pinned models first) and keeps effort and context settings
|
||||
* together above it.
|
||||
*/
|
||||
import { useEffect, useRef, useState, type KeyboardEvent } from "react";
|
||||
import clsx from "clsx";
|
||||
@@ -119,16 +119,16 @@ export function ConfigPickers({
|
||||
const effort = config.find((o) => o.category === "thought_level" && o.values.length > 0);
|
||||
const modelConfigs = modelConfigOptions(config);
|
||||
const hasCostMeta = model?.values.some((v) => !!v.costCategory || !!v.usageMultiplier || !!v.pricing) ?? false;
|
||||
const combinedModel = model && (modelRefresh || modelConfigs.length > 0 || hasCostMeta);
|
||||
const combinedModel = !!model && (!!modelRefresh || modelConfigs.length > 0 || hasCostMeta || !!effort);
|
||||
const tuckedEffort = combinedModel ? (effort ?? null) : null;
|
||||
const tuckedModelConfig = new Set(modelConfigs.map((o) => o.id));
|
||||
const mode = options.find((o) => o.category === "mode");
|
||||
const allowAll = mode && options.find((o) => switchValues(o));
|
||||
// Effort sits right after the model, as its own one-click picker.
|
||||
const inline = options.filter(
|
||||
(o) => o !== effort && o !== allowAll && !(combinedModel && tuckedModelConfig.has(o.id)),
|
||||
);
|
||||
if (effort) inline.splice(model ? inline.indexOf(model) + 1 : 0, 0, effort);
|
||||
// The compact menu holds everything but the model and effort buttons (and the model's own parameters).
|
||||
if (effort && !tuckedEffort) inline.splice(model ? inline.indexOf(model) + 1 : 0, 0, effort);
|
||||
// The compact menu holds everything but the model, effort, and model-specific parameters.
|
||||
const secondary = options.filter(
|
||||
(o) => o.category !== "model" && o !== effort && !(combinedModel && tuckedModelConfig.has(o.id)),
|
||||
);
|
||||
@@ -146,6 +146,8 @@ export function ConfigPickers({
|
||||
model={o}
|
||||
modelValue={valueOf(o)}
|
||||
modelConfigs={modelConfigs}
|
||||
effort={tuckedEffort}
|
||||
effortValue={tuckedEffort ? valueOf(tuckedEffort) : null}
|
||||
valueOf={valueOf}
|
||||
onChange={onChange}
|
||||
modelRefresh={modelRefresh}
|
||||
@@ -254,11 +256,16 @@ function ConfigPicker({
|
||||
);
|
||||
}
|
||||
|
||||
/** The model button: a searchable model list, with context size and the model's own settings above it. */
|
||||
/** Effort levels that fit the popup's segmented control; more (Codex has six) get a dropdown. */
|
||||
const SEGMENTED_EFFORT_MAX = 4;
|
||||
|
||||
/** The model button: a searchable model list, with effort, context size and model settings above it. */
|
||||
function ModelPicker({
|
||||
model,
|
||||
modelValue,
|
||||
modelConfigs,
|
||||
effort,
|
||||
effortValue,
|
||||
valueOf,
|
||||
onChange,
|
||||
modelRefresh,
|
||||
@@ -266,6 +273,8 @@ function ModelPicker({
|
||||
model: AgentConfigOption;
|
||||
modelValue: string | null;
|
||||
modelConfigs: AgentConfigOption[];
|
||||
effort: AgentConfigOption | null;
|
||||
effortValue: string | null;
|
||||
valueOf: (o: AgentConfigOption) => string | null;
|
||||
onChange: (option: string, value: string) => void;
|
||||
modelRefresh?: ModelRefresh;
|
||||
@@ -282,9 +291,13 @@ function ModelPicker({
|
||||
|
||||
const contextOption = modelConfigs.find((o) => isContextOption(o.id) && o.values.length > 0);
|
||||
const contextValue = contextOption ? valueOf(contextOption) : null;
|
||||
const contextLabel = contextOption ? (selected(contextOption, contextValue)?.name ?? null) : null;
|
||||
const contextLabel = contextOption
|
||||
? ((selected(contextOption, contextValue) ?? contextOption.values[0])?.name ?? null)
|
||||
: null;
|
||||
const effortLabel = effort ? ((selected(effort, effortValue) ?? effort.values[0])?.name ?? null) : null;
|
||||
const otherModelConfigs = modelConfigs.filter((o) => o !== contextOption);
|
||||
const summary = [
|
||||
effortLabel ? `${tx("Effort Level")}: ${effortLabel}` : null,
|
||||
contextLabel ? `${tx("Context Size")}: ${contextLabel}` : null,
|
||||
...otherModelConfigs.map((o) => {
|
||||
const current = selected(o, valueOf(o));
|
||||
@@ -310,7 +323,11 @@ function ModelPicker({
|
||||
}}
|
||||
>
|
||||
<span className={styles.chipValue}>{modelName}</span>
|
||||
{contextLabel && <span className={styles.chipDetail}>{contextLabel}</span>}
|
||||
{(effortLabel || contextLabel) && (
|
||||
<span className={clsx(styles.chipDetail, styles.modelDetail)}>
|
||||
{[effortLabel, contextLabel].filter(Boolean).join(" · ")}
|
||||
</span>
|
||||
)}
|
||||
<Icon name="chevron-down" size={14} className={styles.chipChevron} />
|
||||
</button>
|
||||
<Popup
|
||||
@@ -325,8 +342,29 @@ function ModelPicker({
|
||||
<T>Choose another model before starting.</T>
|
||||
</p>
|
||||
)}
|
||||
{(contextOption || otherModelConfigs.length > 0) && (
|
||||
{(effort || contextOption || otherModelConfigs.length > 0) && (
|
||||
<div className={styles.quickSettings}>
|
||||
{effort && (
|
||||
<div className={styles.quickRow}>
|
||||
<span className={styles.quickLabel}>
|
||||
<T>Effort Level</T>
|
||||
</span>
|
||||
{effort.values.length <= SEGMENTED_EFFORT_MAX ? (
|
||||
<SegmentedControl
|
||||
ariaLabel={tx("Effort Level")}
|
||||
options={effort.values.map((v) => ({
|
||||
value: v.value,
|
||||
label: v.name,
|
||||
description: v.description ?? undefined,
|
||||
}))}
|
||||
value={effortValue ?? effort.values[0]!.value}
|
||||
onChange={(v) => onChange(effort.id, v)}
|
||||
/>
|
||||
) : (
|
||||
<ConfigPicker option={effort} value={effortValue} onChange={onChange} framed />
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{contextOption && (
|
||||
<div className={styles.quickRow}>
|
||||
<span className={styles.quickLabel}>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, expect, it, vi } from "vitest";
|
||||
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
||||
import { fireEvent, render, screen, waitFor, within } from "@testing-library/react";
|
||||
import type { AgentConfigOption, AgentProvider, NewAgentTask } from "@/bindings";
|
||||
import { useProject } from "@/platform/project";
|
||||
import { HomeEditor } from "./HomeEditor";
|
||||
@@ -77,26 +77,32 @@ beforeEach(() => {
|
||||
updateComposer(HOME, { text: "Check the project" });
|
||||
});
|
||||
|
||||
const effortButton = () => screen.getByRole("button", { name: "Reasoning" });
|
||||
const modelButton = () => screen.getByRole("button", { name: "Model" });
|
||||
|
||||
async function chooseModel(model: string) {
|
||||
fireEvent.click(screen.getByRole("button", { name: "Model" }));
|
||||
if (!screen.queryByRole("dialog", { name: "Model" })) fireEvent.click(modelButton());
|
||||
fireEvent.click(screen.getByRole("option", { name: model }));
|
||||
fireEvent.pointerDown(document.body);
|
||||
}
|
||||
|
||||
async function chooseEffort(effort: string) {
|
||||
if (!screen.queryByRole("dialog", { name: "Model" })) fireEvent.click(modelButton());
|
||||
const group = screen.getByRole("radiogroup", { name: "Effort Level" });
|
||||
fireEvent.click(within(group).getByRole("radio", { name: effort }));
|
||||
fireEvent.keyDown(document, { key: "Escape" });
|
||||
}
|
||||
|
||||
it("switches model-specific levels and restores each draft effort before starting", async () => {
|
||||
render(<HomeEditor />);
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("big");
|
||||
expect(effortButton()).toHaveTextContent("high");
|
||||
expect(modelButton()).toHaveTextContent("big");
|
||||
expect(modelButton()).toHaveTextContent("high");
|
||||
await chooseModel("small");
|
||||
expect(effortButton()).toHaveTextContent("minimal");
|
||||
fireEvent.click(effortButton());
|
||||
fireEvent.click(screen.getByRole("option", { name: "medium" }));
|
||||
expect(modelButton()).toHaveTextContent("minimal");
|
||||
await chooseEffort("medium");
|
||||
await chooseModel("big");
|
||||
expect(effortButton()).toHaveTextContent("high");
|
||||
expect(modelButton()).toHaveTextContent("high");
|
||||
await chooseModel("small");
|
||||
expect(effortButton()).toHaveTextContent("medium");
|
||||
expect(modelButton()).toHaveTextContent("medium");
|
||||
fireEvent.click(screen.getByRole("button", { name: "Start" }));
|
||||
await waitFor(() => expect(backend.create).toHaveBeenCalled());
|
||||
expect(backend.create.mock.calls[0]![0].config).toEqual([
|
||||
@@ -124,11 +130,13 @@ it("uses GitHub Copilot's own defaults and preserves per-model context tier and
|
||||
};
|
||||
useAgents.setState({ providers: [copilot], draft: savedDraft({ provider: "copilot", config: {} }) });
|
||||
render(<HomeEditor />);
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("gemini-4-carbondefault");
|
||||
expect(effortButton()).toHaveTextContent("medium");
|
||||
expect(modelButton()).toHaveTextContent("gemini-4-carbon");
|
||||
expect(modelButton()).toHaveTextContent("medium");
|
||||
expect(modelButton()).toHaveTextContent("default");
|
||||
await chooseModel("gpt-5.6-sol");
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("gpt-5.6-soldefault");
|
||||
expect(effortButton()).toHaveTextContent("medium");
|
||||
expect(modelButton()).toHaveTextContent("gpt-5.6-sol");
|
||||
expect(modelButton()).toHaveTextContent("medium");
|
||||
expect(modelButton()).toHaveTextContent("default");
|
||||
fireEvent.click(screen.getByRole("button", { name: "Start" }));
|
||||
await waitFor(() => expect(backend.create).toHaveBeenCalled());
|
||||
expect(backend.create.mock.calls[0]![0].config).toEqual([
|
||||
@@ -141,7 +149,7 @@ it("uses GitHub Copilot's own defaults and preserves per-model context tier and
|
||||
it.each(["plain", "unknown"])("hides effort for %s models and sends no stale effort", async (model) => {
|
||||
render(<HomeEditor />);
|
||||
await chooseModel(model);
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveAttribute("aria-haspopup", "dialog");
|
||||
expect(modelButton()).toHaveAttribute("aria-haspopup", "dialog");
|
||||
fireEvent.click(screen.getByRole("button", { name: "Start" }));
|
||||
await waitFor(() => expect(backend.create).toHaveBeenCalled());
|
||||
expect(backend.create.mock.calls[0]![0].config).toEqual([{ id: "model", value: model }]);
|
||||
@@ -162,7 +170,7 @@ it("ignores old provider-wide effort choices and refreshes unsupported per-model
|
||||
draft: savedDraft({ provider: "fake", config: { effort: "low" }, thoughtLevels: { big: { effort: "removed" } } }),
|
||||
});
|
||||
render(<HomeEditor />);
|
||||
expect(effortButton()).toHaveTextContent("high");
|
||||
expect(modelButton()).toHaveTextContent("high");
|
||||
fireEvent.click(screen.getByRole("button", { name: "Start" }));
|
||||
await waitFor(() => expect(backend.create).toHaveBeenCalled());
|
||||
expect(backend.create.mock.calls[0]![0].config).toContainEqual({ id: "effort", value: "high" });
|
||||
|
||||
@@ -219,7 +219,7 @@ it("refreshes an existing chat's searchable model choices and switches through i
|
||||
|
||||
expect(modelButton).toHaveTextContent("old");
|
||||
expect(screen.getByRole("option", { name: "session-only" })).toBeVisible();
|
||||
expect(screen.getByRole("button", { name: "Reasoning" })).toHaveTextContent("low");
|
||||
expect(modelButton).toHaveTextContent("low");
|
||||
expect(screen.getByRole("button", { name: "Mode" })).toHaveTextContent("plan");
|
||||
expect(screen.getByText("Earlier message")).toBeVisible();
|
||||
expect(screen.queryByText("catalog-only")).not.toBeInTheDocument();
|
||||
@@ -324,7 +324,7 @@ it("retains cached model and effort choices after a command failure and retries
|
||||
draft: savedDraft({ provider: "first", config: { model: "big" }, thoughtLevels: { big: { effort: "low" } } }),
|
||||
});
|
||||
render(<HomeEditor />);
|
||||
expect(screen.getByRole("button", { name: "Reasoning" })).toHaveTextContent("low");
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("low");
|
||||
fireEvent.click(screen.getByRole("button", { name: "Model" }));
|
||||
expect(await screen.findByRole("alert")).toHaveTextContent("connection lost");
|
||||
fireEvent.click(screen.getByRole("option", { name: "small" }));
|
||||
@@ -351,7 +351,7 @@ it("preserves a valid remembered model and effort when discovery changes the def
|
||||
render(<HomeEditor />);
|
||||
await waitFor(() => expect(useAgents.getState().modelRequests.size).toBe(0));
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("big");
|
||||
expect(screen.getByRole("button", { name: "Reasoning" })).toHaveTextContent("low");
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("low");
|
||||
fireEvent.click(screen.getByRole("button", { name: "Model" }));
|
||||
expect(screen.getByRole("option", { name: "new" })).toBeVisible();
|
||||
fireEvent.keyDown(document, { key: "Escape" });
|
||||
@@ -471,7 +471,7 @@ it("discovers an uncached model's own settings before its first task and restore
|
||||
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.queryByRole("button", { name: "Reasoning" })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("dialog", { name: "Model" })).not.toBeInTheDocument();
|
||||
expect(backend.create).not.toHaveBeenCalled();
|
||||
await act(async () =>
|
||||
pending.resolve(
|
||||
@@ -489,17 +489,16 @@ it("discovers an uncached model's own settings before its first task and restore
|
||||
),
|
||||
);
|
||||
expect(screen.queryByText("Loading model settings…")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Reasoning" })).toHaveTextContent("medium");
|
||||
fireEvent.click(screen.getByRole("button", { name: "Reasoning" }));
|
||||
fireEvent.click(screen.getByRole("option", { name: "max" }));
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("medium");
|
||||
fireEvent.click(screen.getByRole("button", { name: "Model" }));
|
||||
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("option", { name: "big" }));
|
||||
expect(screen.getByRole("button", { name: "Reasoning" })).toHaveTextContent("high");
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("high");
|
||||
fireEvent.click(screen.getByRole("button", { name: "Model" }));
|
||||
fireEvent.click(screen.getByRole("option", { name: "small" }));
|
||||
expect(screen.getByRole("button", { name: "Reasoning" })).toHaveTextContent("max");
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("max");
|
||||
expect(backend.refresh).toHaveBeenCalledTimes(2);
|
||||
fireEvent.click(screen.getByRole("button", { name: "Start" }));
|
||||
await waitFor(() => expect(backend.create).toHaveBeenCalled());
|
||||
@@ -549,7 +548,7 @@ it("waits for an unrelated lookup and discovers only the latest selected model",
|
||||
ok(catalog("first", { thoughtLevels: { latest: [option("effort", "thought_level", ["medium", "max"])] } })),
|
||||
),
|
||||
);
|
||||
expect(screen.getByRole("button", { name: "Reasoning" })).toHaveTextContent("medium");
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("medium");
|
||||
expect(backend.refresh).toHaveBeenCalledTimes(2);
|
||||
expect(backend.create).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -607,7 +606,7 @@ it("does not leak a delayed model's levels or failure into a newer selection", a
|
||||
),
|
||||
);
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("big");
|
||||
expect(screen.getByRole("button", { name: "Reasoning" })).toHaveTextContent("low");
|
||||
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("low");
|
||||
fireEvent.click(screen.getByRole("button", { name: "Model" }));
|
||||
expect(screen.queryByRole("alert")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Refresh models" })).toBeEnabled();
|
||||
|
||||
Reference in New Issue
Block a user