Refactor application architecture and shared functionality
This commit is contained in:
@@ -113,12 +113,16 @@ export function groupModelsByFamilyWithGetter<T>(
|
||||
* For Google provider with gemini/ and antigravity/ prefixes:
|
||||
* - Gemini 3.x models
|
||||
* - All Claude models
|
||||
* For the Claude provider: every model it reports a limit for.
|
||||
*/
|
||||
export function getDefaultModels(
|
||||
providerId: QuotaProviderId,
|
||||
availableModels: string[]
|
||||
): string[] {
|
||||
return availableModels.filter((model) => {
|
||||
// Anthropic only reports a model here when that model has its own plan
|
||||
// limit, so every one it names is worth showing by default.
|
||||
if (providerId === 'claude') return true;
|
||||
const lower = model.toLowerCase();
|
||||
// Handle gemini/ and antigravity/ prefixes
|
||||
const modelName = lower.includes('/') ? lower.split('/')[1] : lower;
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface QuotaProviderMeta {
|
||||
export const QUOTA_PROVIDERS: QuotaProviderMeta[] = [
|
||||
{ id: 'claude', name: 'Claude' },
|
||||
{ id: 'codex', name: 'Codex' },
|
||||
{ id: 'command-code', name: 'Command Code' },
|
||||
{ id: 'cursor', name: 'Cursor' },
|
||||
{ id: 'github-copilot', name: 'GitHub Copilot' },
|
||||
{ id: 'google', name: 'Google' },
|
||||
|
||||
@@ -75,13 +75,15 @@ export const resolveUsageTone = (percent: number | null): 'safe' | 'warn' | 'cri
|
||||
export const formatWindowLabel = (label: string): string => {
|
||||
if (label === '5h') return t('quota.window.5h');
|
||||
if (label === '7d') return t('quota.window.7d');
|
||||
if (label === '7d-sonnet') return t('quota.window.7dSonnet');
|
||||
if (label === '7d-opus') return t('quota.window.7dOpus');
|
||||
if (label === 'extra_usage') return t('quota.window.extraUsage');
|
||||
if (label === 'weekly') return t('quota.window.weekly');
|
||||
if (label === 'daily') return t('quota.window.daily');
|
||||
if (label === 'monthly') return t('quota.window.monthly');
|
||||
if (label === 'credits') return t('quota.window.credits');
|
||||
if (label === 'credits_balance') return t('quota.window.creditsBalance');
|
||||
if (label === 'monthly_credits') return t('quota.window.monthlyCredits');
|
||||
if (label === 'purchased_credits') return t('quota.window.purchasedCredits');
|
||||
if (label === 'free_credits') return t('quota.window.freeCredits');
|
||||
if (label === 'billing_cycle') return t('quota.window.billingCycle');
|
||||
if (label === 'plan_limit') return t('quota.window.planLimit');
|
||||
if (label === 'auto') return t('quota.window.auto');
|
||||
|
||||
Reference in New Issue
Block a user