GeezerVison is showing github.com — fix(opencode): show Reasoning selector for OpenCode models (#9287) · pingdotgg/t3code@dbc7bfa
File treeExpand file treeCollapse file tree Open diff view settings server/src/provider/Layers
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/server/src/provider/Layers/OpenCodeProvider.ts +33-3Lines changed: 33 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -171,15 +171,45 @@ function inferDefaultAgent(agents: ReadonlyArray<Agent>): string | undefined { | 171 | 171 | } | 172 | 172 |
| 173 | 173 | const DEFAULT_OPENCODE_MODEL_CAPABILITIES: ModelCapabilities = createModelCapabilities({ | 174 | | - optionDescriptors: [], | | 174 | + optionDescriptors: [ | | 175 | + { | | 176 | + id: "variant", | | 177 | + label: "Reasoning", | | 178 | + type: "select", | | 179 | + options: [ | | 180 | + { id: "low", label: "Low" }, | | 181 | + { id: "medium", label: "Medium", isDefault: true }, | | 182 | + { id: "high", label: "High" }, | | 183 | + { id: "xhigh", label: "Extra High" }, | | 184 | + ], | | 185 | + currentValue: "medium", | | 186 | + }, | | 187 | + { | | 188 | + id: "agent", | | 189 | + label: "Agent", | | 190 | + type: "select", | | 191 | + options: [ | | 192 | + { id: "build", label: "Build", isDefault: true }, | | 193 | + { id: "plan", label: "Plan" }, | | 194 | + ], | | 195 | + currentValue: "build", | | 196 | + }, | | 197 | + ], | 175 | 198 | }); | 176 | 199 |
| 177 | 200 | function openCodeCapabilitiesForModel(input: { | 178 | 201 | readonly providerID: string; | 179 | 202 | readonly model: ProviderListResponse["all"][number]["models"][string]; | 180 | 203 | readonly agents: ReadonlyArray<Agent>; | 181 | 204 | }): ModelCapabilities { | 182 | | - const variantValues = Object.keys(input.model.variants ?? {}); | | 205 | + const rawVariantValues = Object.keys(input.model.variants ?? {}); | | 206 | + // When a model advertises no variants, synthesize the standard reasoning | | 207 | + // levels so the composer still offers a Reasoning selector (mirrors the | | 208 | + // Codex/Grok experience where reasoning is always configurable). The set | | 209 | + // covers the common OpenCode variant spectrum; `inferDefaultVariant` | | 210 | + // picks the provider-appropriate default (e.g. medium for openai/opencode). | | 211 | + const variantValues = | | 212 | + rawVariantValues.length > 0 ? rawVariantValues : ["low", "medium", "high", "xhigh"]; | 183 | 213 | const defaultVariant = inferDefaultVariant(input.providerID, variantValues); | 184 | 214 | const variantOptions = variantValues.map((value) => | 185 | 215 | defaultVariant === value | @@ -201,7 +231,7 @@ function openCodeCapabilitiesForModel(input: { | 201 | 231 | ? [ | 202 | 232 | { | 203 | 233 | id: "variant", | 204 | | - label: "Variant", | | 234 | + label: "Reasoning", | 205 | 235 | type: "select" as const, | 206 | 236 | options: variantOptions, | 207 | 237 | ...(defaultVariant ? { currentValue: defaultVariant } : {}), | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/chat/TraitsPicker.test.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -167,7 +167,7 @@ describe("buildUnavailableModelOptionDescriptors", () => { | 167 | 167 | ).toEqual([ | 168 | 168 | { | 169 | 169 | id: "variant", | 170 | | - label: "Variant", | | 170 | + label: "Reasoning", | 171 | 171 | type: "select", | 172 | 172 | options: [{ id: "max", label: "max" }], | 173 | 173 | currentValue: "max", | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/chat/TraitsPicker.tsx +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,7 +40,7 @@ const SAVED_OPTION_LABELS: Readonly<Record<string, string>> = { | 40 | 40 | agent: "Agent", | 41 | 41 | effort: "Effort", | 42 | 42 | reasoningEffort: "Reasoning effort", | 43 | | - variant: "Variant", | | 43 | + variant: "Reasoning", | 44 | 44 | }; | 45 | 45 |
| 46 | 46 | function savedOptionLabel(id: string): string { | |
|