From d92128faed92d8269a4c7459bffdeb9876a6d9da Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 05:06:13 +0000 Subject: [PATCH] plan: fix chat URL, key mask UX, and 401 error handling Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- docs/index.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/index.html b/docs/index.html index 9b5a0af9..7bcab782 100644 --- a/docs/index.html +++ b/docs/index.html @@ -565,11 +565,17 @@ const FB_BRAIN = { // ═══════════════════════════════════════════════════════ // STATE // ═══════════════════════════════════════════════════════ +// Derive base URL from saved provider; never use stale zy_base for named providers +const _initProv = ls('zy_prov')||'yunwu'; +const _initBase = _initProv === 'custom' + ? (ls('zy_base')||'') + : (PROVS[_initProv]?.base||'https://api.yunwu.ai/v1'); + const A = { key: ls('zy_key')||'', - base: ls('zy_base')||'https://api.yunwu.ai/v1', + base: _initBase, mdl: ls('zy_mdl')||'gpt-4o', - prov: ls('zy_prov')||'yunwu', + prov: _initProv, demo: false, brain: null, routing: null, @@ -916,8 +922,8 @@ async function streamReply(txt){ }), }); if(!res.ok){ - const provName=PROVS[A.prov]?.base||A.base; - let em=provName+' 返回错误 '+res.status; + const provLabel = A.prov==='custom' ? A.base : (A.prov+'('+A.base+')'); + let em='['+provLabel+'] 返回错误 '+res.status; try{const e=await res.json();em=e.error?.message||em;}catch(_){} throw new Error(em); }