修复XSS: innerHTML改为DOM API创建重连按钮

Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/f776c06a-3f23-484d-98a9-322eba565fcf

Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-12 06:30:59 +00:00 committed by GitHub
parent 2ff4036bb4
commit 077d5afeee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -2821,7 +2821,14 @@ async function checkChatBackend(){
var tip=document.createElement('div');
tip.id='chatConnTip';
tip.className='cm s';
tip.innerHTML='⚠️ 后端服务暂时未连接。本地智能回复可用配置API密钥可解锁AI对话。<br><button onclick="retryChatBackend()" style="margin-top:6px;padding:4px 12px;border-radius:4px;border:1px solid var(--accent,#6ea8fe);background:transparent;color:var(--accent,#6ea8fe);cursor:pointer;font-size:12px">🔄 重新连接</button>';
var tipText=document.createTextNode('⚠️ 后端服务暂时未连接。本地智能回复可用配置API密钥可解锁AI对话。');
tip.appendChild(tipText);
tip.appendChild(document.createElement('br'));
var retryBtn=document.createElement('button');
retryBtn.textContent='🔄 重新连接';
retryBtn.style.cssText='margin-top:6px;padding:4px 12px;border-radius:4px;border:1px solid var(--accent,#6ea8fe);background:transparent;color:var(--accent,#6ea8fe);cursor:pointer;font-size:12px';
retryBtn.addEventListener('click',retryChatBackend);
tip.appendChild(retryBtn);
chatMs.appendChild(tip);
chatMs.scrollTop=chatMs.scrollHeight;
}