export function formatContextWindow(size?: number): string { if (!size) return '-'; // For M: prefer decimal (use decimal for exact thousands) if (size >= 1000000) { if (size % 1000000 === 0) { return `${size / 1000000}M`; } return `${(size / 1000000).toFixed(1)}M`; } // For K: prefer decimal if divisible by 1000, otherwise use binary if (size >= 1000) { if (size % 1000 === 0) { return `${size / 1000}K`; } return `${Math.floor(size / 1024)}K`; } return size.toString(); } export function getProviderTypeLabel(type: string, t: (key: string) => string): string { const translationKey = `settings.providerTypes.${type}`; const translated = t(translationKey); // If translation exists (not equal to key), use it; otherwise fallback to type return translated !== translationKey ? translated : type; }