feat(tui): persist model tier selection and fix formatting
Persist /model tier choice to ~/.local/share/flynn/preferences.json so it survives restarts. Decode HTML entities (e.g. ') in markdown renderer output. Suppress noisy logger.info and punycode deprecation warnings in TUI startup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+13
-1
@@ -75,7 +75,11 @@ export function registerTuiCommand(program: Command): void {
|
||||
// Dynamic imports to keep CLI startup fast
|
||||
const { SessionStore, SessionManager } = await import('../session/index.js');
|
||||
|
||||
setLogLevel(config.log_level);
|
||||
// In the TUI, default to 'warn' so model-router and other info messages
|
||||
// don't clutter the interactive terminal. Honour the user's explicit
|
||||
// choice if they set log_level to something more verbose.
|
||||
const tuiLogLevel = config.log_level === 'debug' ? 'debug' : 'warn';
|
||||
setLogLevel(tuiLogLevel);
|
||||
const { MinimalTui, startFullscreenTui } = await import('../frontends/tui/index.js');
|
||||
const { NativeAgent } = await import('../backends/index.js');
|
||||
const { ToolRegistry, ToolExecutor, allBuiltinTools, createWebSearchTools, createProcessTools, ProcessManager, createGmailTools, createGcalTools } = await import('../tools/index.js');
|
||||
@@ -90,8 +94,16 @@ export function registerTuiCommand(program: Command): void {
|
||||
|
||||
// Reuse the daemon's model router factory — includes auto-fallback,
|
||||
// local_providers, retry config, and per-tier fallback logic.
|
||||
const { loadPreferences, savePreference } = await import('../preferences.js');
|
||||
const modelRouter = createModelRouter(config);
|
||||
|
||||
// Restore persisted model tier and save future changes
|
||||
const prefs = loadPreferences(dataDir);
|
||||
if (prefs.modelTier) {
|
||||
modelRouter.setTier(prefs.modelTier as import('../models/router.js').ModelTier);
|
||||
}
|
||||
modelRouter.setOnTierChange((tier) => savePreference(dataDir, 'modelTier', tier));
|
||||
|
||||
const { initPairingManager } = await import('../daemon/services.js');
|
||||
const pairingStore = config.pairing.enabled ? sessionStore.getPairingStore() : undefined;
|
||||
const pairingManager = initPairingManager(config, pairingStore);
|
||||
|
||||
Reference in New Issue
Block a user