refactor: extract formatCompactNumber util and add last_used_at to refresh key

- Add formatCompactNumber() for consistent large-number formatting (K/M/B)
- Include last_used_at in OpenAI usage refresh key for better change detection
- Add .gitattributes eol=lf rules for frontend source files
This commit is contained in:
Ethan0x0000
2026-03-16 16:22:51 +08:00
parent fa782e70a4
commit 8640a62319
5 changed files with 75 additions and 1 deletions

View File

@@ -5,7 +5,7 @@ const normalizeUsageRefreshValue = (value: unknown): string => {
return String(value)
}
export const buildOpenAIUsageRefreshKey = (account: Pick<Account, 'id' | 'platform' | 'type' | 'updated_at' | 'rate_limit_reset_at' | 'extra'>): string => {
export const buildOpenAIUsageRefreshKey = (account: Pick<Account, 'id' | 'platform' | 'type' | 'updated_at' | 'last_used_at' | 'rate_limit_reset_at' | 'extra'>): string => {
if (account.platform !== 'openai' || account.type !== 'oauth') {
return ''
}
@@ -14,6 +14,7 @@ export const buildOpenAIUsageRefreshKey = (account: Pick<Account, 'id' | 'platfo
return [
account.id,
account.updated_at,
account.last_used_at,
account.rate_limit_reset_at,
extra.codex_usage_updated_at,
extra.codex_5h_used_percent,