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 <noreply@anthropic.com>
This commit is contained in:
@@ -10,20 +10,14 @@ import { HybridStrategy } from './hybrid-strategy.js';
|
|||||||
import { logger } from '../../utils/logger.js';
|
import { logger } from '../../utils/logger.js';
|
||||||
import {
|
import {
|
||||||
SELECTION_STRATEGIES,
|
SELECTION_STRATEGIES,
|
||||||
DEFAULT_SELECTION_STRATEGY
|
DEFAULT_SELECTION_STRATEGY,
|
||||||
|
STRATEGY_LABELS
|
||||||
} from '../../constants.js';
|
} from '../../constants.js';
|
||||||
|
|
||||||
// Re-export strategy constants for convenience
|
// Re-export strategy constants for convenience
|
||||||
export const STRATEGY_NAMES = SELECTION_STRATEGIES;
|
export const STRATEGY_NAMES = SELECTION_STRATEGIES;
|
||||||
export const DEFAULT_STRATEGY = DEFAULT_SELECTION_STRATEGY;
|
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
|
* Create a strategy instance
|
||||||
* @param {string} strategyName - Name of the strategy ('sticky', 'round-robin', 'hybrid')
|
* @param {string} strategyName - Name of the strategy ('sticky', 'round-robin', 'hybrid')
|
||||||
|
|||||||
@@ -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 SELECTION_STRATEGIES = ['sticky', 'round-robin', 'hybrid'];
|
||||||
export const DEFAULT_SELECTION_STRATEGY = '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
|
// Gemini-specific limits
|
||||||
export const GEMINI_MAX_OUTPUT_TOKENS = 16384;
|
export const GEMINI_MAX_OUTPUT_TOKENS = 16384;
|
||||||
|
|
||||||
@@ -263,6 +270,7 @@ export default {
|
|||||||
isThinkingModel,
|
isThinkingModel,
|
||||||
OAUTH_CONFIG,
|
OAUTH_CONFIG,
|
||||||
OAUTH_REDIRECT_URI,
|
OAUTH_REDIRECT_URI,
|
||||||
|
STRATEGY_LABELS,
|
||||||
MODEL_FALLBACK_MAP,
|
MODEL_FALLBACK_MAP,
|
||||||
TEST_MODELS,
|
TEST_MODELS,
|
||||||
DEFAULT_PRESETS,
|
DEFAULT_PRESETS,
|
||||||
|
|||||||
@@ -60,8 +60,11 @@ const server = app.listen(PORT, () => {
|
|||||||
const align4 = (text) => text + ' '.repeat(Math.max(0, 58 - text.length));
|
const align4 = (text) => text + ' '.repeat(Math.max(0, 58 - text.length));
|
||||||
|
|
||||||
// Build Control section dynamically
|
// Build Control section dynamically
|
||||||
|
const strategyOptions = `(${STRATEGY_NAMES.join('/')})`;
|
||||||
|
const strategyLine2 = ' ' + strategyOptions;
|
||||||
let controlSection = '║ Control: ║\n';
|
let controlSection = '║ Control: ║\n';
|
||||||
controlSection += '║ --strategy=<s> Set selection strategy (sticky/hybrid) ║\n';
|
controlSection += '║ --strategy=<s> Set account selection strategy ║\n';
|
||||||
|
controlSection += `${border} ${align(strategyLine2)}${border}\n`;
|
||||||
if (!isDebug) {
|
if (!isDebug) {
|
||||||
controlSection += '║ --debug Enable debug logging ║\n';
|
controlSection += '║ --debug Enable debug logging ║\n';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user