import json,urllib.request from pathlib import Path root=Path(__file__).resolve().parent.parent base=json.loads((root/'huobao-data/last-launch.json').read_text())['api'] def req(path,body=None): r=urllib.request.Request(base+path,data=json.dumps(body).encode() if body else None,headers={'Content-Type':'application/json'},method='PUT' if body else 'GET') with urllib.request.urlopen(r,timeout=30) as response:return json.load(response)['data'] before=req('/ai-configs');changes=[] for row in before: if '双卡自动调度' in row['name']: req('/ai-configs/'+str(row['id']),{'name':row['name'].replace('双卡自动调度','三卡可选')});changes.append(row['id']) after={row['id']:row for row in req('/ai-configs')} keys=('base_url','api_key','model','provider','priority','is_active','settings') assert all(all(row[k]==after[row['id']][k] for k in keys) for row in before) report={'updated_labels':changes,'credentials_models_priorities_and_gpu_preferences_unchanged':True,'configs':len(after)} (root/'integration-work/final-gpu-config-audit.json').write_text(json.dumps(report,indent=2),encoding='utf-8') print(json.dumps(report))