fix: OCG collector skips non-opencode_go provider accounts (key7 Kimi was leaking into OCG section)

This commit is contained in:
hmo
2026-07-19 20:22:04 +08:00
parent e509334ff4
commit bfb6bfba59
+9 -2
View File
@@ -607,12 +607,16 @@ def collect_all(cdp_only=False):
collected_count = 0 collected_count = 0
cdp_key_id = None cdp_key_id = None
# ── PRIMARY: HTTP collection for all accounts ── # ── PRIMARY: HTTP collection for OpenCode Go accounts only ──
if not cdp_only: if not cdp_only:
for acc_cfg in accounts_cfg.get('accounts', []): for acc_cfg in accounts_cfg.get('accounts', []):
key_id = acc_cfg.get('key_id', '') key_id = acc_cfg.get('key_id', '')
provider = acc_cfg.get('provider', 'opencode_go')
if not key_id: if not key_id:
continue continue
# Skip non-OCG providers (Kimi etc.)
if provider != 'opencode_go':
continue
result = collect_via_http(key_id, acc_cfg) result = collect_via_http(key_id, acc_cfg)
merge_result_into_cache(cache, key_id, result) merge_result_into_cache(cache, key_id, result)
@@ -635,9 +639,12 @@ def collect_all(cdp_only=False):
except Exception as e: except Exception as e:
log.warning(f'CDP bonus collection skipped: {e}') log.warning(f'CDP bonus collection skipped: {e}')
# ── Build output ── # ── Build output (OpenCode Go accounts only) ──
accounts_list = [] accounts_list = []
for acc_cfg in accounts_cfg.get('accounts', []): for acc_cfg in accounts_cfg.get('accounts', []):
# Skip non-OCG providers
if acc_cfg.get('provider', 'opencode_go') != 'opencode_go':
continue
kid = acc_cfg.get('key_id', acc_cfg.get('workspace_id', '?')) kid = acc_cfg.get('key_id', acc_cfg.get('workspace_id', '?'))
if kid in cache.get('accounts', {}): if kid in cache.get('accounts', {}):
# Merge in account config fields # Merge in account config fields