diff --git a/README.md b/README.md index 2e84f4ee..e79212de 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ **一句话:点下面这个链接就能打开,直接聊天。** -### 👉 [点这里打开铸渊聊天室](https://qinfendebingshuo.github.io/guanghulab/) +### 👉 [点这里打开铸渊聊天室](https://qinfendebingshuo.github.io/guanghulab/docs/index.html) ``` -https://qinfendebingshuo.github.io/guanghulab/ +https://qinfendebingshuo.github.io/guanghulab/docs/index.html ``` > 把这个链接发给任何人,他们打开就能用,不需要安装任何东西。 @@ -20,7 +20,7 @@ https://qinfendebingshuo.github.io/guanghulab/ ### ❄️ 冰朔(你) -1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/ +1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/docs/index.html 2. **选身份** → 下拉菜单选「❄️ 冰朔(语言架构师·创始人)」 3. **填 API 密钥** → 输入你的云雾/OpenAI/DeepSeek API Key 4. **点「开始对话」** → 铸渊自动唤醒,汇报大脑状态 @@ -30,7 +30,7 @@ https://qinfendebingshuo.github.io/guanghulab/ ### 🦁 肥猫(光湖团队总控 · DEV-002) -1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/ +1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/docs/index.html 2. **选身份** → 下拉菜单选「🦁 肥猫(光湖团队总控·DEV-002)」 3. **填 API 密钥** → 输入自己的 API Key(或点「演示模式」也能看进度面板) 4. **点「开始对话」** → 铸渊自动打开**总控指挥台**,显示全员进度 @@ -44,7 +44,7 @@ https://qinfendebingshuo.github.io/guanghulab/ ### 🍊 桔子(光湖主控 · DEV-010) -1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/ +1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/docs/index.html 2. **选身份** → 下拉菜单选「🍊 桔子(光湖主控·DEV-010)」 3. **填 API 密钥** → 输入自己的 API Key 4. **点「开始对话」** → 铸渊显示你当前模块进度,并开放指挥台 @@ -53,7 +53,7 @@ https://qinfendebingshuo.github.io/guanghulab/ ### 👩‍💻 其他开发者(页页 / 燕樊 / 小草莓 / 花尔 等) -1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/ +1. **打开链接** → https://qinfendebingshuo.github.io/guanghulab/docs/index.html 2. **选身份** → 下拉菜单选自己的名字 3. **填 API 密钥** → 填自己的 Key(没有的话点「演示模式」) 4. **点「开始对话」** → 铸渊显示你的当前任务状态,可以问问题 @@ -80,7 +80,7 @@ https://qinfendebingshuo.github.io/guanghulab/ ``` 铸渊聊天室入口 👇 -https://qinfendebingshuo.github.io/guanghulab/ +https://qinfendebingshuo.github.io/guanghulab/docs/index.html 打开后选择你的身份,填入 API Key 就能和铸渊说话了。 ``` diff --git a/docs/index.html b/docs/index.html index 7bcab782..b7d54ed7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -360,8 +360,11 @@ footer{padding:12px 18px 16px;background:var(--s1);border-top:1px solid var(--bo
- - 🔒 只保存在浏览器 localStorage,不上传任何服务器 +
+ + +
+ 🔒 只保存在浏览器 localStorage,不上传任何服务器
@@ -689,6 +692,13 @@ function initSettingsPanel(){ 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 + const hint = document.getElementById('ck-hint'); + if(hint){ + hint.textContent = A.key + ? '🔒 当前 Key 末4位:…'+A.key.slice(-4)+' · 要换新 Key 请点「清空重填」再输入' + : '🔒 只保存在浏览器 localStorage,不上传任何服务器'; + } if(pv==='custom'){ document.getElementById('cep-g').style.display='block'; document.getElementById('cep').value = A.base; @@ -697,6 +707,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; @@ -924,8 +941,11 @@ async function streamReply(txt){ if(!res.ok){ const provLabel = A.prov==='custom' ? A.base : (A.prov+'('+A.base+')'); let em='['+provLabel+'] 返回错误 '+res.status; + let isAuthErr = (res.status===401||res.status===403); try{const e=await res.json();em=e.error?.message||em;}catch(_){} - throw new Error(em); + const err = new Error(em); + err.isAuth = isAuthErr; + throw err; } let full=''; const rdr=res.body.getReader(); @@ -951,7 +971,14 @@ async function streamReply(txt){ A.msgs.push({role:'assistant',content:full}); addCopyBtns(el); }catch(e){ - el.innerHTML='⚠️ '+esc(e.message)+'
请检查 API 密钥和网络连接,或在 ⚙️ 设置中更换模型。'; + if(e.isAuth){ + el.innerHTML='🔑 API 密钥认证失败' + +'
'+esc(e.message)+'' + +'
' + +'
打开设置 → 点「清空重填」→ 输入新密钥 → 保存'; + } else { + el.innerHTML='⚠️ '+esc(e.message)+'
请检查 API 密钥和网络连接,或在 ⚙️ 设置中更换模型。'; + } A.msgs.pop(); }finally{ A.streaming=false; updSendBtn(); scrollB(); @@ -1179,7 +1206,9 @@ function closeP(){ // ═══════════════════════════════════════════════════════ // COPY URL (share link) // ═══════════════════════════════════════════════════════ -const CHAT_URL = 'https://' + REPO.split('/')[0] + '.github.io/' + REPO.split('/')[1] + '/'; +// Auto-detect the real URL so the share link is always correct +// regardless of whether Pages serves from docs/ or repo root. +const CHAT_URL = window.location.origin + window.location.pathname; function showCopyFeedback(success){ const btn=document.querySelector('.copy-url-btn');