mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
fix(schedules): fall back to the config default model when an override is gone (#356)
* fix(schedules): fall back to the config default model when an override is gone * fix(schedules): never fall back to the configured small model * fix(schedules): distinguish unknown availability and match configured models by key and id
This commit is contained in:
1 parent
f175aa73a6
commit
50da84541a
10 files changed
+492
-144
No files matched your search
@@ -2,7 +2,6 @@ import type { OpenCodeClient } from './opencode/client'
|
||||
|
||||
interface OpenCodeConfigResponse {
|
||||
model?: string
|
||||
small_model?: string
|
||||
}
|
||||
|
||||
interface OpenCodeProviderResponse {
|
||||
@@ -76,7 +75,6 @@ export async function resolveOpenCodeModel(
|
||||
directory: string | undefined,
|
||||
options?: {
|
||||
preferredModel?: string | null
|
||||
preferSmallModel?: boolean
|
||||
},
|
||||
): Promise<ResolvedOpenCodeModel> {
|
||||
const [config, providersResponse] = await Promise.all([
|
||||
@@ -86,10 +84,7 @@ export async function resolveOpenCodeModel(
|
||||
|
||||
const availableModels = buildAvailableModels(providersResponse)
|
||||
const defaultModels = providersResponse.default ?? {}
|
||||
const configCandidates = options?.preferSmallModel
|
||||
? [config.small_model, config.model]
|
||||
: [config.model, config.small_model]
|
||||
const candidates = uniqueCandidates([options?.preferredModel, ...configCandidates])
|
||||
const candidates = uniqueCandidates([options?.preferredModel, config.model])
|
||||
|
||||
for (const candidate of candidates) {
|
||||
if (availableModels.has(candidate)) {
|
||||
|
||||
Reference in new issue
Block a user