fix(relay): fix llm_routing read path bug and add User-Agent header for Coding Plan
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

1. connectionStore.ts: storedAccount.account.llm_routing → storedAccount.llm_routing
   - saveSaaSSession stores SaaSAccountInfo directly, not { account: SaaSAccountInfo }
   - This bug caused admin llm_routing config to never take effect

2. relay/service.rs: add User-Agent: claude-code/1.0 header
   - Kimi Coding Plan requires recognized coding agent User-Agent
   - Default reqwest UA is rejected with 403

3. Docs: add llm_routing routing mode explanation and troubleshooting entries
This commit is contained in:
iven
2026-03-31 12:02:32 +08:00
parent ee51d5abcd
commit 3e5d64484e
4 changed files with 77 additions and 4 deletions

View File

@@ -358,8 +358,9 @@ export const useConnectionStore = create<ConnectionStore>((set, get) => {
const raw = localStorage.getItem('zclaw-saas-account');
if (raw) {
const storedAccount = JSON.parse(raw);
// storedAccount is SaaSAccountInfo (saved directly by saveSaaSSession)
// 类型安全解析: 仅接受 'relay' | 'local' 两个合法值
const adminRouting = storedAccount?.account?.llm_routing;
const adminRouting = storedAccount?.llm_routing;
if (adminRouting === 'relay') {
// Force SaaS Relay mode — admin override
localStorage.setItem('zclaw-connection-mode', 'saas');