#!/usr/bin/env python3 """Fix NewAPI channel types and remove expired channels.""" from newapi_client import update_channel, delete_channel, test_channel from channels_config import FIX_TABLE # ─── Fix channel types to OpenAI (type 1) ──────────────────────── print("=== Fixing channel types to OpenAI (type 1) ===\n") for cid, name, new_type, base_url in FIX_TABLE: success, msg = update_channel(cid, type=new_type, base_url=base_url) print(f" ID={cid:2d} {name:30s} -> type={new_type} base_url={base_url} " f"{'✅' if success else '❌'} {msg}") # ─── Delete expired Baidu Qianfan ──────────────────────────────── print("\n=== Deleting expired Baidu Qianfan ===") success, msg = delete_channel(13) print(f" ID=13 BaiduQianfan-Coding {'✅' if success else '❌'} {msg}") # ─── Re-test all fixed channels ────────────────────────────────── print("\n=== Testing fixed channels ===\n") test_ids = [6, 7, 8, 9, 10, 11, 12] # 11=VolcanoArk-CodingPlan (already working) for cid in test_ids: print(f" ID={cid:2d}...", end=" ", flush=True) success, msg, _ = test_channel(cid) print(f"{'✅' if success else '❌'} {msg[:80]}")