From c8c7a5a8aaa2a1640497ca59c9cd3eb8a886d0d5 Mon Sep 17 00:00:00 2001 From: Badri Narayanan S Date: Sun, 18 Jan 2026 12:59:33 +0530 Subject: [PATCH] refactor: move STRATEGY_LABELS to constants.js and make banner dynamic Consolidate strategy configuration by moving STRATEGY_LABELS from strategies/index.js to constants.js. Update startup banner to dynamically display strategy options from SELECTION_STRATEGIES. Co-Authored-By: Claude --- src/account-manager/strategies/index.js | 10 ++-------- src/constants.js | 8 ++++++++ src/index.js | 5 ++++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/account-manager/strategies/index.js b/src/account-manager/strategies/index.js index 239170a..70ae00c 100644 --- a/src/account-manager/strategies/index.js +++ b/src/account-manager/strategies/index.js @@ -10,20 +10,14 @@ import { HybridStrategy } from './hybrid-strategy.js'; import { logger } from '../../utils/logger.js'; import { SELECTION_STRATEGIES, - DEFAULT_SELECTION_STRATEGY + DEFAULT_SELECTION_STRATEGY, + STRATEGY_LABELS } from '../../constants.js'; // Re-export strategy constants for convenience export const STRATEGY_NAMES = SELECTION_STRATEGIES; export const DEFAULT_STRATEGY = DEFAULT_SELECTION_STRATEGY; -// Strategy display labels -export const STRATEGY_LABELS = { - 'sticky': 'Sticky (Cache Optimized)', - 'round-robin': 'Round Robin (Load Balanced)', - 'hybrid': 'Hybrid (Smart Distribution)' -}; - /** * Create a strategy instance * @param {string} strategyName - Name of the strategy ('sticky', 'round-robin', 'hybrid') diff --git a/src/constants.js b/src/constants.js index e8136e3..ad20ccf 100644 --- a/src/constants.js +++ b/src/constants.js @@ -121,6 +121,13 @@ export const MIN_SIGNATURE_LENGTH = 50; // Minimum valid thinking signature leng export const SELECTION_STRATEGIES = ['sticky', 'round-robin', 'hybrid']; export const DEFAULT_SELECTION_STRATEGY = 'hybrid'; +// Strategy display labels +export const STRATEGY_LABELS = { + 'sticky': 'Sticky (Cache Optimized)', + 'round-robin': 'Round Robin (Load Balanced)', + 'hybrid': 'Hybrid (Smart Distribution)' +}; + // Gemini-specific limits export const GEMINI_MAX_OUTPUT_TOKENS = 16384; @@ -263,6 +270,7 @@ export default { isThinkingModel, OAUTH_CONFIG, OAUTH_REDIRECT_URI, + STRATEGY_LABELS, MODEL_FALLBACK_MAP, TEST_MODELS, DEFAULT_PRESETS, diff --git a/src/index.js b/src/index.js index 8864766..de948a0 100644 --- a/src/index.js +++ b/src/index.js @@ -60,8 +60,11 @@ const server = app.listen(PORT, () => { const align4 = (text) => text + ' '.repeat(Math.max(0, 58 - text.length)); // Build Control section dynamically + const strategyOptions = `(${STRATEGY_NAMES.join('/')})`; + const strategyLine2 = ' ' + strategyOptions; let controlSection = '║ Control: ║\n'; - controlSection += '║ --strategy= Set selection strategy (sticky/hybrid) ║\n'; + controlSection += '║ --strategy= Set account selection strategy ║\n'; + controlSection += `${border} ${align(strategyLine2)}${border}\n`; if (!isDebug) { controlSection += '║ --debug Enable debug logging ║\n'; }