Repository navigation
feat(acp): show Qoder reasoning levels in the model picker #33212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0c697af
cbad133
9c59598
83026e5
bab388d
d086305
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,73 @@ export function flattenSelectChoices( | |
| return options.flatMap((candidate) => ("value" in candidate ? [candidate] : candidate.options)); | ||
| } | ||
|
|
||
| const THOUGHT_LEVEL_ORDER = [ | ||
| "minimal", | ||
| "low", | ||
| "medium", | ||
| "high", | ||
| "xhigh", | ||
| "extra-high", | ||
| "extra_high", | ||
| "max", | ||
| "none", | ||
| "off", | ||
| ] as const; | ||
|
|
||
| const THOUGHT_LEVEL_RANK = new Map<string, number>( | ||
| THOUGHT_LEVEL_ORDER.map((id, index) => [id, index]), | ||
| ); | ||
|
|
||
| function thoughtLevelLabel(id: string, fallback: string, separateMax: boolean): string { | ||
| switch (id) { | ||
| case "minimal": | ||
| return "Minimal"; | ||
| case "low": | ||
| return "Low"; | ||
| case "medium": | ||
| return "Medium"; | ||
| case "high": | ||
| return "High"; | ||
| case "xhigh": | ||
| case "extra-high": | ||
| case "extra_high": | ||
| return "Extra High"; | ||
| case "max": | ||
| // One top bucket is Extra High. Max stays Max only when Extra High is also offered. | ||
| return separateMax ? "Max" : "Extra High"; | ||
| case "none": | ||
| return "None"; | ||
| case "off": | ||
| return "Off"; | ||
| default: | ||
| return fallback; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Agents omit a default flag. Qoder's `reasoning_effort` column badges High as Default | ||
| * while the check mark stays on `currentValue`. Other thought levels must not get that | ||
| * flag: `isDefault` is also the value used when `currentValue` is absent. | ||
| */ | ||
| function presentThoughtLevelChoices( | ||
| choices: ReadonlyArray<ProviderOptionChoice>, | ||
| badgeHighAsDefault: boolean, | ||
| ): ReadonlyArray<ProviderOptionChoice> { | ||
| const ids = new Set(choices.map((choice) => choice.id)); | ||
| const separateMax = ids.has("xhigh") || ids.has("extra-high") || ids.has("extra_high"); | ||
| return [...choices] | ||
| .sort( | ||
| (left, right) => | ||
| (THOUGHT_LEVEL_RANK.get(left.id) ?? THOUGHT_LEVEL_RANK.size) - | ||
| (THOUGHT_LEVEL_RANK.get(right.id) ?? THOUGHT_LEVEL_RANK.size), | ||
| ) | ||
| .map((choice) => ({ | ||
| ...choice, | ||
| label: thoughtLevelLabel(choice.id, choice.label, separateMax), | ||
| ...(badgeHighAsDefault && choice.id === "high" ? { isDefault: true } : {}), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not mark High as the selected value when the agent reports no current value.
Changing another option can also save High. Keep the badge out of the selected value. Carry the High badge in display-only metadata that the resolver does not read. With no reported value, leave both rows unchecked, and do not write
|
||
| })); | ||
| } | ||
|
|
||
| function selectChoices( | ||
| candidates: ReadonlyArray<{ | ||
| readonly value: string; | ||
|
|
@@ -100,12 +167,16 @@ export function acpProviderOptionDescriptors(input: { | |
| if (isThoughtLevel) { | ||
| mirroredModeChoiceSets.push(new Set(choices.map((choice) => choice.id))); | ||
| } | ||
| const presentedChoices = isThoughtLevel | ||
| ? presentThoughtLevelChoices(choices, id === "reasoning_effort") | ||
| : choices; | ||
| const currentValue = choiceId(option.currentValue); | ||
| descriptors.push({ | ||
| ...base, | ||
| ...(isThoughtLevel ? { label: "Reasoning" } : {}), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Localize the ACP reasoning heading and level labels. The model picker renders the server-supplied descriptor heading and choice labels as plain text. The server sends Resolve the heading and the known level labels through the web and mobile message catalogs. The web catalog already has The repository requires that user-facing text ships in every locale.
|
||
| type: "select", | ||
| options: choices, | ||
| ...(currentValue && choices.some((choice) => choice.id === currentValue) | ||
| options: presentedChoices, | ||
| ...(currentValue && presentedChoices.some((choice) => choice.id === currentValue) | ||
| ? { currentValue } | ||
| : {}), | ||
| ...(isThoughtLevel ? { role: "reasoning" as const } : {}), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep distinct extra-high choices distinguishable.
If an agent advertises
xhighasXhighandextra_highasExtra High, both IDs pass validation. The picker then shows two identicalExtra Highrows that send different IDs. When normalization creates a label collision, retain the distinct provider labels or add a visible qualifier. Keep both IDs selectable. (raw.githubusercontent.com)