From 447f6a7b3b73f7b705e74fd63f2cdae8afe66883 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 05:17:41 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=A0=B9=E6=9C=AC=E4=BF=AE=E5=A4=8D=20K?= =?UTF-8?q?EY=5FMASK=20bug=EF=BC=8C=E5=AF=86=E9=92=A5=E6=A1=86=E5=A7=8B?= =?UTF-8?q?=E7=BB=88=E4=B8=BA=E7=A9=BA=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E6=89=80=E6=9C=89=E8=AE=BE=E7=BD=AE=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- docs/index.html | 56 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/docs/index.html b/docs/index.html index b7d54ed7..9fbb3f37 100644 --- a/docs/index.html +++ b/docs/index.html @@ -360,10 +360,7 @@ footer{padding:12px 18px 16px;background:var(--s1);border-top:1px solid var(--bo
遇到密钥卡住、无法更新等问题时,点下方按钮彻底清除本地设置,从头重新输入。
+ @@ -556,6 +557,8 @@ const MODES = { const MODE_ORD = ['chat','build','review','brain']; const FB_COV = {implemented:3,total:17,percent:'17.6%'}; +// KEY_MASK is no longer used in the input field; kept only for backward compatibility +// with any saved value that might still be in localStorage. const KEY_MASK = '(已保存)'; const FB_BRAIN = { @@ -601,6 +604,11 @@ function lss(k,v){localStorage.setItem(k,v)} // INIT // ═══════════════════════════════════════════════════════ async function boot(){ + // Sanitize: if a previous version accidentally stored the KEY_MASK string as the key, clear it. + if(ls('zy_key') === KEY_MASK){ + localStorage.removeItem('zy_key'); + A.key = ''; + } initSetupUI(); // Restore identity from localStorage if(A.userName) A.userMeta = ROLE_MAP[A.userName]||null; @@ -691,13 +699,14 @@ function initSettingsPanel(){ const pv = A.prov||'yunwu'; document.getElementById('cp').value = pv; fillModels('cm', pv, A.mdl); - document.getElementById('ck').value = A.key?KEY_MASK:''; - // Show last 4 chars of current key so user can verify they're changing to a new one + // Always show EMPTY field — never prefill with a mask string. + // Empty on save = keep old key; any typed value = replace key. + document.getElementById('ck').value = ''; const hint = document.getElementById('ck-hint'); if(hint){ hint.textContent = A.key - ? '🔒 当前 Key 末4位:…'+A.key.slice(-4)+' · 要换新 Key 请点「清空重填」再输入' - : '🔒 只保存在浏览器 localStorage,不上传任何服务器'; + ? '🔒 当前已保存 Key 末4位:…'+(A.key.length>=4?A.key.slice(-4):A.key)+' · 留空保持不变,直接输入新 Key 即可替换' + : '🔒 尚未设置 API 密钥,请输入后保存'; } if(pv==='custom'){ document.getElementById('cep-g').style.display='block'; @@ -707,18 +716,13 @@ function initSettingsPanel(){ if(A.ghUser) document.getElementById('cghuser').value=A.ghUser; } -function clearKeyField(){ - const el = document.getElementById('ck'); - if(el){el.value='';el.focus();} - const hint = document.getElementById('ck-hint'); - if(hint) hint.textContent = '✏️ 请输入新的 API 密钥,输入完成后点「保存设置」'; -} - function saveSet(){ const pv = document.getElementById('cp').value; const md = document.getElementById('cm').value; const raw = document.getElementById('ck').value.trim(); - const k = raw===KEY_MASK? A.key : raw; + // Empty field = keep existing key; any non-empty input = use as new key. + // Never use KEY_MASK string comparison — that caused mixed-input bugs. + const k = raw || A.key; let base = PROVS[pv]?.base||''; if(pv==='custom') base=(document.getElementById('cep').value.trim())||base; A.key=k; A.base=base; A.mdl=md; A.prov=pv; A.demo=!k; @@ -731,7 +735,18 @@ function saveSet(){ document.getElementById('bbdemo').style.display=A.demo?'inline':'none'; applyIdentityUI(); closeP(); - botMsg('✅ 设置已保存。模型:'+esc(md)+''+(un?' · 身份:'+esc(un):'')+(A.demo?'