import { OLLAMA_URL, OLLAMA_PORT } from "../config.js"; import { getActiveChatModel, getActiveAutocompleteModel, getActiveTui, } from "../runtime-config.js"; const BOLD = "\x1b[1m"; const GREEN = "\x1b[0;32m"; const RED = "\x1b[0;31m"; const DIM = "\x1b[2m"; const RESET = "\x1b[0m"; async function checkOllama(): Promise { try { const res = await fetch(`${OLLAMA_URL}/api/tags`); return res.ok; } catch { return false; } } export async function showStatus(): Promise { const chatModel = getActiveChatModel(); const autoModel = getActiveAutocompleteModel(); const tui = getActiveTui(); const ollamaOk = await checkOllama(); const on = `${GREEN}running${RESET}`; const off = `${RED}stopped${RESET}`; console.log(` ${BOLD}localcode${RESET} — current configuration ${BOLD}Chat model:${RESET} ${chatModel.name} ${DIM}(${chatModel.ollamaTag})${RESET} ${BOLD}Autocomplete model:${RESET} ${autoModel.name} ${DIM}(${autoModel.ollamaTag})${RESET} ${BOLD}Active TUI:${RESET} ${tui.name} ${DIM}(${tui.id})${RESET} ${BOLD}Ollama:${RESET} :${OLLAMA_PORT} ${ollamaOk ? on : off} `); }