From a2e1f73493457881bb71176e2e27394dde754634 Mon Sep 17 00:00:00 2001 From: William Valentin Date: Thu, 5 Feb 2026 13:37:26 -0800 Subject: [PATCH] feat: wire up localProviders config to TUI Add LlamaCppClient to imports and handle llamacpp provider in createModelRouter. Pass localProviders and currentLocalProvider configuration to MinimalTui to enable the /backend command to access alternate provider configs. Co-Authored-By: Claude Opus 4.5 --- src/tui.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tui.ts b/src/tui.ts index 94491ff..c6d9af2 100644 --- a/src/tui.ts +++ b/src/tui.ts @@ -1,6 +1,6 @@ import { loadConfig } from './config/index.js'; import { SessionStore, SessionManager } from './session/index.js'; -import { AnthropicClient, OpenAIClient, OllamaClient, ModelRouter } from './models/index.js'; +import { AnthropicClient, OpenAIClient, OllamaClient, LlamaCppClient, ModelRouter } from './models/index.js'; import { MinimalTui, startFullscreenTui } from './frontends/tui/index.js'; import type { Config } from './config/index.js'; import { resolve } from 'path'; @@ -49,6 +49,11 @@ function createModelRouter(config: Config): ModelRouter { model: models.local.model, host: models.local.endpoint, }); + } else if (models.local.provider === 'llamacpp') { + localClient = new LlamaCppClient({ + endpoint: models.local.endpoint ?? 'http://localhost:8080', + authToken: models.local.auth_token, + }); } } @@ -124,6 +129,8 @@ async function main() { modelClient: modelRouter, modelRouter, systemPrompt: SYSTEM_PROMPT, + localProviders: config.models.local_providers, + currentLocalProvider: config.models.local?.provider, onTransfer: (target) => { if (target === 'telegram') { const telegramUserId = String(config.telegram.allowed_chat_ids[0]);