fix(volc_sync): correct GLM-4 mapping and add raw package logging

This commit is contained in:
kim
2026-01-29 16:49:14 +08:00
parent 16e233f374
commit dd0eb2b1ad
+21 -5
View File
@@ -93,6 +93,7 @@ VOLC_MODEL_MAP = {
"deepseek-r1": "deepseek-r1-250528", "deepseek-r1": "deepseek-r1-250528",
"kimi-k2": "kimi-k2-thinking-251104", "kimi-k2": "kimi-k2-thinking-251104",
"glm-4_7": "glm-4-7-251222", "glm-4_7": "glm-4-7-251222",
"glm-4-7": "glm-4-7-251222",
} }
# Static Quotas (Fallback/Strict Limits) # Static Quotas (Fallback/Strict Limits)
@@ -535,17 +536,32 @@ def fetch_all_packages():
def process_packages_breakdown(packages): def process_packages_breakdown(packages):
model_counts = {} model_counts = {}
print(f"\n--- Raw Package Processing ---", flush=True)
for pkg in packages: for pkg in packages:
try:
raw_code = pkg.get("ConfigurationCode", "") raw_code = pkg.get("ConfigurationCode", "")
raw_name = pkg.get("ConfigurationName", "Unknown") raw_name = pkg.get("ConfigurationName", "Unknown")
target_raw = raw_code if raw_code else raw_name target_raw = raw_code if raw_code else raw_name
model_name = normalize_volc_name(target_raw) model_name = normalize_volc_name(target_raw)
try:
available = int(pkg.get("AvailableAmount", 0)) available = pkg.get("AvailableAmount", 0)
if pkg.get("Unit", "token").lower() == "token": unit = pkg.get("Unit", "token")
model_counts[model_name] = model_counts.get(model_name, 0) + available
except ValueError: # 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 continue
return model_counts return model_counts