Skip to content

Commit 4c1b55b

Browse files
committed
fix: 修正 apiSchema 和 usageSchema 中的模型记录类型,确保键为字符串
1 parent 8e649bc commit 4c1b55b

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lib/usage.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ const apiSchema = z.object({
4646
total_tokens: z.number().optional(),
4747
success_count: z.number().optional(),
4848
failure_count: z.number().optional(),
49-
models: z.record(modelSchema).optional()
49+
models: z.record(z.string(), modelSchema).optional()
5050
});
5151

5252
const usageSchema = z.object({
5353
total_requests: z.number().optional(),
5454
success_count: z.number().optional(),
5555
failure_count: z.number().optional(),
5656
total_tokens: z.number().optional(),
57-
requests_by_day: z.record(z.number()).optional(),
58-
requests_by_hour: z.record(z.number()).optional(),
59-
tokens_by_day: z.record(z.number()).optional(),
60-
tokens_by_hour: z.record(z.number()).optional(),
61-
apis: z.record(apiSchema).optional()
57+
requests_by_day: z.record(z.string(), z.number()).optional(),
58+
requests_by_hour: z.record(z.string(), z.number()).optional(),
59+
tokens_by_day: z.record(z.string(), z.number()).optional(),
60+
tokens_by_hour: z.record(z.string(), z.number()).optional(),
61+
apis: z.record(z.string(), apiSchema).optional()
6262
});
6363

6464
const responseSchema = z.object({ usage: usageSchema.optional() });

0 commit comments

Comments
 (0)