mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-06 23:01:08 +00:00
修复:MiniMax coding_plan 将 interval/weekly usage_count 按剩余配额解析
This commit is contained in:
committed by
Peter Steinberger
parent
edc470f6b0
commit
cca35404ea
@@ -116,6 +116,20 @@ describe("fetchMinimaxUsage", () => {
|
||||
windows: [{ label: "5h", usedPercent: 75, resetAt: 1_700_000_000_000 }],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "treats MiniMax current_interval_usage_count as remaining quota (not consumed)",
|
||||
payload: {
|
||||
data: {
|
||||
current_interval_total_count: 100,
|
||||
current_interval_usage_count: 98,
|
||||
plan_name: "Coding Plan",
|
||||
},
|
||||
},
|
||||
expected: {
|
||||
plan: "Coding Plan",
|
||||
windows: [{ label: "5h", usedPercent: 2, resetAt: undefined }],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "falls back to payload-level reset and plan when nested usage records omit them",
|
||||
payload: {
|
||||
|
||||
@@ -67,8 +67,6 @@ const USED_KEYS = [
|
||||
"usedPrompt",
|
||||
"prompts_used",
|
||||
"promptsUsed",
|
||||
"current_interval_usage_count",
|
||||
"currentIntervalUsageCount",
|
||||
"consumed",
|
||||
] as const;
|
||||
|
||||
@@ -96,6 +94,8 @@ const TOTAL_KEYS = [
|
||||
"totalPrompts",
|
||||
"current_interval_total_count",
|
||||
"currentIntervalTotalCount",
|
||||
"current_weekly_total_count",
|
||||
"currentWeeklyTotalCount",
|
||||
"limit",
|
||||
"quota",
|
||||
"quota_limit",
|
||||
@@ -133,6 +133,12 @@ const REMAINING_KEYS = [
|
||||
"prompts_left",
|
||||
"promptsLeft",
|
||||
"left",
|
||||
// MiniMax `/coding_plan/remains` misnames these: values are remaining quota, not consumed.
|
||||
// See https://github.com/MiniMax-AI/MiniMax-M2/issues/99
|
||||
"current_interval_usage_count",
|
||||
"currentIntervalUsageCount",
|
||||
"current_weekly_usage_count",
|
||||
"currentWeeklyUsageCount",
|
||||
] as const;
|
||||
|
||||
const PLAN_KEYS = ["plan", "plan_name", "planName", "product", "tier"] as const;
|
||||
|
||||
@@ -214,12 +214,13 @@ describe("provider usage loading", () => {
|
||||
end_time: 1736235600,
|
||||
remains_time: 600,
|
||||
current_interval_total_count: 120,
|
||||
// API field is remaining quota, not consumed (MiniMax-M2#99).
|
||||
current_interval_usage_count: 30,
|
||||
model_name: "MiniMax-M2.5",
|
||||
},
|
||||
],
|
||||
},
|
||||
expected: { usedPercent: 25 },
|
||||
expected: { usedPercent: 75 },
|
||||
},
|
||||
{
|
||||
name: "keeps payload-level MiniMax plan metadata when the usage candidate is nested",
|
||||
|
||||
Reference in New Issue
Block a user