fix(volc_sync): correct GLM-4 mapping and add raw package logging
This commit is contained in:
+21
-5
@@ -93,6 +93,7 @@ VOLC_MODEL_MAP = {
|
||||
"deepseek-r1": "deepseek-r1-250528",
|
||||
"kimi-k2": "kimi-k2-thinking-251104",
|
||||
"glm-4_7": "glm-4-7-251222",
|
||||
"glm-4-7": "glm-4-7-251222",
|
||||
}
|
||||
|
||||
# Static Quotas (Fallback/Strict Limits)
|
||||
@@ -535,17 +536,32 @@ def fetch_all_packages():
|
||||
|
||||
def process_packages_breakdown(packages):
|
||||
model_counts = {}
|
||||
print(f"\n--- Raw Package Processing ---", flush=True)
|
||||
for pkg in packages:
|
||||
try:
|
||||
raw_code = pkg.get("ConfigurationCode", "")
|
||||
raw_name = pkg.get("ConfigurationName", "Unknown")
|
||||
target_raw = raw_code if raw_code else raw_name
|
||||
model_name = normalize_volc_name(target_raw)
|
||||
try:
|
||||
available = int(pkg.get("AvailableAmount", 0))
|
||||
if pkg.get("Unit", "token").lower() == "token":
|
||||
model_counts[model_name] = model_counts.get(model_name, 0) + available
|
||||
except ValueError:
|
||||
|
||||
available = pkg.get("AvailableAmount", 0)
|
||||
unit = pkg.get("Unit", "token")
|
||||
|
||||
# Debug log to trace mapping
|
||||
if DEBUG_MODE or "glm" in model_name or "doubao" in model_name:
|
||||
print(
|
||||
f"DEBUG: Pkg Raw='{target_raw}' -> Norm='{model_name}', Avail={available}",
|
||||
flush=True,
|
||||
)
|
||||
|
||||
if unit.lower() == "token":
|
||||
model_counts[model_name] = model_counts.get(model_name, 0) + int(
|
||||
available
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Error processing package: {e}")
|
||||
continue
|
||||
|
||||
return model_counts
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user