mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-19 11:10:49 +08:00
feat(quota): add normalization for Gemini CLI model IDs and update quota groups
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
import type { CodexUsagePayload, GeminiCliQuotaPayload } from '@/types';
|
||||
|
||||
const GEMINI_CLI_MODEL_SUFFIX = '_vertex';
|
||||
|
||||
export function normalizeAuthIndexValue(value: unknown): string | null {
|
||||
if (typeof value === 'number' && Number.isFinite(value)) {
|
||||
return value.toString();
|
||||
@@ -26,6 +28,15 @@ export function normalizeStringValue(value: unknown): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
export function normalizeGeminiCliModelId(value: unknown): string | null {
|
||||
const modelId = normalizeStringValue(value);
|
||||
if (!modelId) return null;
|
||||
if (modelId.endsWith(GEMINI_CLI_MODEL_SUFFIX)) {
|
||||
return modelId.slice(0, -GEMINI_CLI_MODEL_SUFFIX.length);
|
||||
}
|
||||
return modelId;
|
||||
}
|
||||
|
||||
export function normalizeNumberValue(value: unknown): number | null {
|
||||
if (typeof value === 'number' && Number.isFinite(value)) return value;
|
||||
if (typeof value === 'string') {
|
||||
|
||||
Reference in New Issue
Block a user