refactor: make telegram config optional for non-telegram setups

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
William Valentin
2026-02-10 09:27:18 -08:00
parent 48fab11066
commit 213dba855a
7 changed files with 32 additions and 21 deletions
+7 -3
View File
@@ -154,9 +154,13 @@ export function registerTuiCommand(program: Command): void {
currentLocalProvider: config.models.local?.provider,
onTransfer: (target) => {
if (target === 'telegram') {
const telegramUserId = String(config.telegram.allowed_chat_ids[0]);
sessionManager.transferSession('tui', 'local', 'telegram', telegramUserId);
console.log(`Session transferred to Telegram (${telegramUserId})\n`);
if (config.telegram && config.telegram.allowed_chat_ids.length > 0) {
const telegramUserId = String(config.telegram.allowed_chat_ids[0]);
sessionManager.transferSession('tui', 'local', 'telegram', telegramUserId);
console.log(`Session transferred to Telegram (${telegramUserId})\n`);
} else {
console.log('Telegram not configured\n');
}
} else {
console.log(`Unknown transfer target: ${target}\n`);
}