fix: TUI now uses shared model router with auto-fallback support

The TUI was building its own ModelRouter with a duplicated client factory
that lacked auto same-model fallback, local_providers resolution, retry
config, and per-tier fallback logic. When Anthropic failed, it skipped
GitHub Models and fell straight to the local Ollama model.

Replace the duplicated ~50-line createClient + router setup in tui.ts
with a single call to the daemon's createModelRouter(), which already
handles all of these correctly. This removes ~50 lines of duplicated
code and ensures TUI and daemon have identical fallback behavior.
This commit is contained in:
William Valentin
2026-02-07 13:58:34 -08:00
parent f43d6edfe0
commit e12eb3a0be
2 changed files with 5 additions and 61 deletions
+1 -1
View File
@@ -175,7 +175,7 @@ export function createAutoFallbackClient(tierConfig: { provider: string; model:
});
}
function createModelRouter(config: Config): ModelRouter {
export function createModelRouter(config: Config): ModelRouter {
const models = config.models;
const defaultClient = createClientFromConfig(models.default);