From e1666fe93d767a797d822c8a3353f14e86635afa Mon Sep 17 00:00:00 2001 From: kicer Date: Tue, 8 Sep 2026 09:19:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D=E9=A1=B5=E7=82=B9=E6=96=87=E4=BB=B6=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E8=87=AA=E5=8A=A8=E5=88=9B=E5=BB=BA=E4=BC=9A=E8=AF=9D?= =?UTF-8?q?=E5=86=8D=E5=BC=B9=E6=96=87=E4=BB=B6=E9=9D=A2=E6=9D=BF=EF=BC=8C?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=97=B6=E6=8F=90=E7=A4=BA=E5=8E=9F=E5=9B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/server/public/index.html | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/server/public/index.html b/app/server/public/index.html index 6663f4b..9809c69 100644 --- a/app/server/public/index.html +++ b/app/server/public/index.html @@ -1817,10 +1817,23 @@ $('files-mask').classList.toggle('show', open); $('attach-btn').classList.toggle('active', open); } - function toggleFilesPanel() { + let ensuringSessionForFiles = false; // 防止建会话请求发出前重复点击按钮导致连建两个会话 + async function toggleFilesPanel() { const panel = $('files-panel'); const open = !panel.classList.contains('open'); - if (open && !state.sessionId) { toast('先发送一条消息创建会话,再管理任务文件'); return; } + if (open && !state.sessionId) { + // 新建会话页直接管理文件:自动建档会话再弹面板;建会话失败(如无可用模型)给出提示 + if (ensuringSessionForFiles) return; + ensuringSessionForFiles = true; + try { + await ensureSession(); + } catch (e) { + toast('创建会话失败:' + e.message); + return; + } finally { + ensuringSessionForFiles = false; + } + } setFilesPanel(open); } $('attach-btn').addEventListener('click', toggleFilesPanel);