Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/web/src/components/chat/EffortGlyph.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ describe("resolveEffortGlyph", () => {
});
});

it("names max instead of drawing it", () => {
it("names Max and Default instead of drawing them", () => {
expect(resolveEffortGlyph(claude, "max")?.special).toBe("Max");
const reported = descriptor(["default", "low", "medium", "high", "xhigh", "max"]);
expect(resolveEffortGlyph(reported, "default")?.special).toBe("Default");
expect(resolveEffortGlyph(reported, "low")).toMatchObject({ count: 4, filled: 1 });
});

it("names Ultracode and Ultrathink instead of drawing a level", () => {
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/components/chat/EffortGlyph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ const BASELINE_INSET = 2;
type SelectDescriptor = Extract<ProviderOptionDescriptor, { type: "select" }>;

// Older servers offer Ultracode as a level. It changes the workflow, so it keeps its name.
// Max is named too, so the full scale stops short of it.
const NAMED_LEVELS = new Set(["ultracode", "max"]);
// Max is named too, so the full scale stops short of it. Default leaves the level to the agent.
const NAMED_LEVELS = new Set(["ultracode", "max", "default"]);
const OFF_LEVELS = new Set(["off", "none"]);
// More bars than this no longer fit the glyph's height in whole pixels.
const MAX_BARS = 7;

/**
* Maps a reasoning select to bars: one per ordinary level, filled up to the current one, with an
* off level as none filled. Max, prompt-injected and workflow levels are named instead of drawn.
* off level as none filled. Max, Default, prompt-injected and workflow levels are named instead.
*/
export function resolveEffortGlyph(descriptor: SelectDescriptor, current: string | null) {
const special = new Set([...(descriptor.promptInjectedValues ?? []), ...NAMED_LEVELS]);
Expand Down
Loading