fallback changes from PR #35

This commit is contained in:
Badri Narayanan S
2026-01-03 18:01:21 +05:30
parent 9c4a712a9a
commit df6625b531
5 changed files with 86 additions and 7 deletions

View File

@@ -12,6 +12,7 @@ import os from 'os';
// Parse command line arguments
const args = process.argv.slice(2);
const isDebug = args.includes('--debug') || process.env.DEBUG === 'true';
const isFallbackEnabled = args.includes('--fallback') || process.env.FALLBACK === 'true';
// Initialize logger
logger.setDebug(isDebug);
@@ -20,6 +21,13 @@ if (isDebug) {
logger.debug('Debug mode enabled');
}
if (isFallbackEnabled) {
logger.info('Model fallback mode enabled');
}
// Export fallback flag for server to use
export const FALLBACK_ENABLED = isFallbackEnabled;
const PORT = process.env.PORT || DEFAULT_PORT;
// Home directory for account storage
@@ -40,14 +48,22 @@ app.listen(PORT, () => {
if (!isDebug) {
controlSection += '║ --debug Enable debug logging ║\n';
}
if (!isFallbackEnabled) {
controlSection += '║ --fallback Enable model fallback on quota exhaust ║\n';
}
controlSection += '║ Ctrl+C Stop server ║';
// Build status section if debug mode is active
// Build status section if any modes are active
let statusSection = '';
if (isDebug) {
if (isDebug || isFallbackEnabled) {
statusSection = '║ ║\n';
statusSection += '║ Active Modes: ║\n';
statusSection += '║ ✓ Debug mode enabled ║\n';
if (isDebug) {
statusSection += '║ ✓ Debug mode enabled ║\n';
}
if (isFallbackEnabled) {
statusSection += '║ ✓ Model fallback enabled ║\n';
}
}
logger.log(`