mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-23 18:55:37 -04:00
fix(tui): don't fallback to first provider when agents loading
When using the placeholder agent (before real agents load), return undefined instead of falling back to the first provider's model. This prevents showing google-vertex-anthropic models before the agent's configured model loads. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -205,15 +205,19 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
|
||||
|
||||
const currentModel = createMemo(() => {
|
||||
const a = agent.current()
|
||||
// If using placeholder agent (no name), don't return any model yet
|
||||
if (!a?.name) {
|
||||
return undefined
|
||||
}
|
||||
// Agent's configured model takes priority - trust it without validation
|
||||
// Custom models (like cerebras/zai-glm-4.7) may not be in the provider list
|
||||
if (a?.model) {
|
||||
if (a.model) {
|
||||
return a.model
|
||||
}
|
||||
// For non-configured agents, use cached selection or fallback (with validation)
|
||||
return (
|
||||
getFirstValidModel(
|
||||
() => modelStore.model[a?.name ?? ""], // Cached selection
|
||||
() => modelStore.model[a.name], // Cached selection
|
||||
fallbackModel, // Global fallback
|
||||
) ?? undefined
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user