Files
OmniRoute/src/types/settings.ts
Anderson Firmino a8a29e17c5 feat: strict-random strategy, API key management, connection groups, Limits UX
- Combo layer: strict-random in combo.ts rotates models uniformly
- Credential layer: strict-random in auth.ts rotates connections/accounts
- Anti-repeat guarantee: last of previous cycle ≠ first of next
- Mutex serialization for concurrent request safety
- Independent decks per combo name and per provider

- allowedConnections: restrict which connections a key can use
- autoResolve: per-key toggle for ambiguous model disambiguation
- is_active: enable/disable key instantly (403 on disabled)
- accessSchedule: time-based access control (hours, days, timezone)
- Rename keys via PATCH /api/keys/:id
- Connection restriction badge in API keys table
- Auto-migration for all new columns

- Connection group field on provider connections
- Environment grouping view in Limits page (group by environment)
- Accordion UI with expand/collapse per group
- localStorage persistence for groupBy, autoRefresh, expandedGroups
- Smart default: auto-switches to environment view when groups exist
- Swap SessionsTab above RateLimitStatus

- strict-random option added to combo strategy dropdown (30 languages)
- strategyGuide.strict-random (when/avoid/example)
- pt-BR: translated all strategyRecommendations from English to Portuguese
- en: added API key management strings (accessSchedule, isActive, etc.)

- 11 tests: shuffle deck mechanics (Fisher-Yates, anti-repeat, decks)
- 6 tests: allowedConnections (schema, DB persistence, cache invalidation)
- 12 tests: API key policy (isActive, accessSchedule, autoResolve, budget)
2026-03-14 14:03:08 -03:00

44 lines
885 B
TypeScript

/**
* Application settings stored in SQLite key-value pairs.
*/
export interface Settings {
requireLogin: boolean;
hasPassword: boolean;
fallbackStrategy:
| "fill-first"
| "round-robin"
| "p2c"
| "random"
| "least-used"
| "cost-optimized"
| "strict-random";
stickyRoundRobinLimit: number;
jwtSecret?: string;
}
export interface ComboDefaults {
strategy: "priority" | "weighted" | "round-robin";
maxRetries: number;
retryDelayMs: number;
timeoutMs: number;
healthCheckEnabled: boolean;
healthCheckTimeoutMs: number;
maxComboDepth: number;
trackMetrics: boolean;
concurrencyPerModel?: number;
queueTimeoutMs?: number;
}
export interface ProxyConfig {
type: "http" | "https" | "socks5";
host: string;
port: number;
username?: string;
password?: string;
}
export interface KVPair {
key: string;
value: string;
}