fix(quota): stop showing misleading OpenRouter percentages (#1127)
* fix(quota): stop showing misleading OpenRouter percentages Fixes #1085 * fix(quota): clean up OpenRouter credit labels --------- Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
b65edc3436
commit
3fbcdbc3dc
@@ -3,6 +3,7 @@ export type { QuotaProviderMeta } from './providers';
|
||||
export {
|
||||
clampPercent,
|
||||
formatPercent,
|
||||
formatQuotaValueLabel,
|
||||
resolveUsageTone,
|
||||
formatWindowLabel,
|
||||
calculatePace,
|
||||
|
||||
@@ -12,6 +12,13 @@ export const formatPercent = (value: number | null): string => {
|
||||
return `${Math.round(value)}%`;
|
||||
};
|
||||
|
||||
export const formatQuotaValueLabel = (
|
||||
valueLabel: string | null | undefined,
|
||||
percent: number | null,
|
||||
): string => {
|
||||
return valueLabel ?? formatPercent(percent);
|
||||
};
|
||||
|
||||
export const resolveUsageTone = (percent: number | null): 'safe' | 'warn' | 'critical' => {
|
||||
if (percent === null) {
|
||||
return 'safe';
|
||||
|
||||
Reference in New Issue
Block a user