fix(opencode): show Reasoning selector for OpenCode models (#9287)
Co-authored-by: maria-rcks <[email protected]>
This commit is contained in:
1 parent
2971ec3209
commit
dbc7bfa3f3
3 files changed
+35
-5
No files matched your search
@@ -171,7 +171,30 @@ function inferDefaultAgent(agents: ReadonlyArray<Agent>): string | undefined {
|
||||
}
|
||||
|
||||
const DEFAULT_OPENCODE_MODEL_CAPABILITIES: ModelCapabilities = createModelCapabilities({
|
||||
optionDescriptors: [],
|
||||
optionDescriptors: [
|
||||
{
|
||||
id: "variant",
|
||||
label: "Reasoning",
|
||||
type: "select",
|
||||
options: [
|
||||
{ id: "low", label: "Low" },
|
||||
{ id: "medium", label: "Medium", isDefault: true },
|
||||
{ id: "high", label: "High" },
|
||||
{ id: "xhigh", label: "Extra High" },
|
||||
],
|
||||
currentValue: "medium",
|
||||
},
|
||||
{
|
||||
id: "agent",
|
||||
label: "Agent",
|
||||
type: "select",
|
||||
options: [
|
||||
{ id: "build", label: "Build", isDefault: true },
|
||||
{ id: "plan", label: "Plan" },
|
||||
],
|
||||
currentValue: "build",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
function openCodeCapabilitiesForModel(input: {
|
||||
@@ -179,7 +202,14 @@ function openCodeCapabilitiesForModel(input: {
|
||||
readonly model: ProviderListResponse["all"][number]["models"][string];
|
||||
readonly agents: ReadonlyArray<Agent>;
|
||||
}): ModelCapabilities {
|
||||
const variantValues = Object.keys(input.model.variants ?? {});
|
||||
const rawVariantValues = Object.keys(input.model.variants ?? {});
|
||||
// When a model advertises no variants, synthesize the standard reasoning
|
||||
// levels so the composer still offers a Reasoning selector (mirrors the
|
||||
// Codex/Grok experience where reasoning is always configurable). The set
|
||||
// covers the common OpenCode variant spectrum; `inferDefaultVariant`
|
||||
// picks the provider-appropriate default (e.g. medium for openai/opencode).
|
||||
const variantValues =
|
||||
rawVariantValues.length > 0 ? rawVariantValues : ["low", "medium", "high", "xhigh"];
|
||||
const defaultVariant = inferDefaultVariant(input.providerID, variantValues);
|
||||
const variantOptions = variantValues.map((value) =>
|
||||
defaultVariant === value
|
||||
@@ -201,7 +231,7 @@ function openCodeCapabilitiesForModel(input: {
|
||||
? [
|
||||
{
|
||||
id: "variant",
|
||||
label: "Variant",
|
||||
label: "Reasoning",
|
||||
type: "select" as const,
|
||||
options: variantOptions,
|
||||
...(defaultVariant ? { currentValue: defaultVariant } : {}),
|
||||
|
||||
@@ -167,7 +167,7 @@ describe("buildUnavailableModelOptionDescriptors", () => {
|
||||
).toEqual([
|
||||
{
|
||||
id: "variant",
|
||||
label: "Variant",
|
||||
label: "Reasoning",
|
||||
type: "select",
|
||||
options: [{ id: "max", label: "max" }],
|
||||
currentValue: "max",
|
||||
|
||||
@@ -40,7 +40,7 @@ const SAVED_OPTION_LABELS: Readonly<Record<string, string>> = {
|
||||
agent: "Agent",
|
||||
effort: "Effort",
|
||||
reasoningEffort: "Reasoning effort",
|
||||
variant: "Variant",
|
||||
variant: "Reasoning",
|
||||
};
|
||||
|
||||
function savedOptionLabel(id: string): string {
|
||||
|
||||
Reference in new issue
Block a user