From 491a0defe664870808ed56d821811f9c154ab6ae Mon Sep 17 00:00:00 2001 From: kicer Date: Mon, 31 Aug 2026 10:45:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E5=9B=9B=E5=A4=84=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=9A=E5=B7=A5=E5=85=B7=E5=8D=A1=E7=89=87=20spin?= =?UTF-8?q?=20=E5=9B=BE=E6=A0=87=E5=8E=BB=E6=8E=89=E8=BD=AC=E5=9C=88?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=EF=BC=88=E5=AE=8C=E6=88=90=E5=90=8E=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E6=98=BE=E7=A4=BA=20=E2=9C=93/=E2=9C=95=EF=BC=89?= =?UTF-8?q?=EF=BC=9B=E5=B1=95=E5=BC=80=E5=B7=A5=E5=85=B7=E5=8D=A1=E7=89=87?= =?UTF-8?q?=E6=97=B6=E6=96=B0=E5=A2=9E=20tool-args-full=20=E5=9D=97?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E5=B1=95=E7=A4=BA=E8=B0=83=E7=94=A8=E5=8F=82?= =?UTF-8?q?=E6=95=B0=EF=BC=88pretty=20JSON=EF=BC=89=EF=BC=8C=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E5=A1=AB=E5=85=A5=E7=8B=AC=E7=AB=8B=E7=9A=84=20tool-r?= =?UTF-8?q?esult=20=E5=9D=97=EF=BC=9B=E6=B6=88=E6=81=AF=E6=B0=94=E6=B3=A1?= =?UTF-8?q?=E5=86=85=20ul/ol=20=E6=81=A2=E5=A4=8D=E7=BC=A9=E8=BF=9B?= =?UTF-8?q?=E4=B8=8E=E5=A4=96=E8=BE=B9=E8=B7=9D=EF=BC=8C=E5=9C=86=E7=82=B9?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E6=BA=A2=E5=87=BA=20msg-bubble=EF=BC=9B?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BC=9A=E8=AF=9D=E6=94=B9=E4=B8=BA=E5=8D=95?= =?UTF-8?q?=E4=B8=AA=E5=BC=B9=E7=AA=97=EF=BC=88=E5=86=85=E5=90=AB=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=B8=8D=E5=8B=BE=E9=80=89=E7=9A=84=E3=80=90=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E5=88=A0=E9=99=A4=E4=BB=BB=E5=8A=A1=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E3=80=91=EF=BC=89=EF=BC=8C=E5=8F=96=E6=B6=88=E4=B8=A4=E6=AC=A1?= =?UTF-8?q?=20confirm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/server/public/css/style.css | 22 ++++++++++++++++++++-- app/server/public/index.html | 13 +++++++++++++ app/server/public/js/app.js | 29 ++++++++++++++++++++++++----- 3 files changed, 57 insertions(+), 7 deletions(-) diff --git a/app/server/public/css/style.css b/app/server/public/css/style.css index f6ede6f..9f81b89 100644 --- a/app/server/public/css/style.css +++ b/app/server/public/css/style.css @@ -128,6 +128,8 @@ body { .msg-bubble table { border-collapse: collapse; margin: 6px 0; display: block; overflow-x: auto; } .msg-bubble th, .msg-bubble td { border: 1px solid #dde; padding: 4px 8px; font-size: 13px; } .msg-bubble blockquote { border-left: 3px solid #ccd; padding-left: 8px; color: #667; margin: 4px 0; } +.msg-bubble ul, .msg-bubble ol { padding-left: 1.5em; margin: 6px 0; } +.msg-bubble li { margin: 2px 0; } .msg-time { font-size: 10px; color: #aab; margin-top: 3px; } /* 工具卡片 */ @@ -146,8 +148,8 @@ body { font-size: 12px; color: #55492a; } .tool-card.error { background: #fdecea; border-color: #f2c4bd; color: #a3352a; } -.tool-card .spin { display: inline-block; animation: rot 1s linear infinite; } -@keyframes rot { to { transform: rotate(360deg); } } +.tool-card .spin { display: inline-block; width: 1em; text-align: center; } +.tool-card .tool-args-full { color: #6b5b2a; } /* ---- 文件面板 ---- */ .files-panel { @@ -227,6 +229,22 @@ body { font-size: 15px; font-weight: 600; cursor: pointer; } .primary-btn:active { opacity: 0.9; } +.ghost-btn { + flex: 1; background: #f2f3f7; color: #445; border: 1px solid #dde; + border-radius: 10px; padding: 11px; font-size: 15px; cursor: pointer; +} +.ghost-btn:active { background: #e8eaf0; } +.btn-row { display: flex; gap: 10px; } +.btn-row .primary-btn { flex: 1; } +.modal .modal-text { font-size: 14px; color: #556; margin-bottom: 12px; } +.modal .del-dir { + display: flex; align-items: center; gap: 7px; + font-size: 14px; color: #334; margin-bottom: 14px; cursor: pointer; +} +.modal .del-dir input { + width: 16px; height: 16px; padding: 0; margin: 0; flex-shrink: 0; + accent-color: #c33; +} /* ---- Toast ---- */ .toast { diff --git a/app/server/public/index.html b/app/server/public/index.html index 97cd46e..5878849 100644 --- a/app/server/public/index.html +++ b/app/server/public/index.html @@ -93,6 +93,19 @@ + + + diff --git a/app/server/public/js/app.js b/app/server/public/js/app.js index 8cdd3ba..5954c9f 100644 --- a/app/server/public/js/app.js +++ b/app/server/public/js/app.js @@ -15,6 +15,7 @@ const state = { streamText: '', toolCards: {}, filePanelOpen: false, + pendingDeleteId: null, }; // ---------- API ---------- @@ -69,6 +70,10 @@ function toolArgsSummary(name, argsStr) { if (s.length > 80) s = s.slice(0, 80) + '…'; return s; } +function toolArgsFull(argsStr) { + try { return JSON.stringify(JSON.parse(argsStr || '{}'), null, 2); } + catch (_) { return argsStr || ''; } +} // ---------- 页面切换 ---------- function showChat() { @@ -151,7 +156,8 @@ function renderToolCard(id, name, argsStr) { '
◌' + '' + esc(name) + '' + '' + esc(toolArgsSummary(name, argsStr)) + '' + - '
执行中…
'; + '
' + esc(toolArgsFull(argsStr)) + '
' + + '
执行中…
'; return div; } @@ -160,7 +166,8 @@ function fillToolResult(id, content, isError) { if (!card) return; if (isError) card.classList.add('error'); card.querySelector('.spin').textContent = isError ? '✕' : '✓'; - card.querySelector('pre').textContent = content || '(空)'; + const pre = card.querySelector('.tool-result'); + if (pre) pre.textContent = content || '(空)'; } function msgNode(m, cardMap) { @@ -360,9 +367,21 @@ const ui = { this.openSession(s.id); } catch (e) { toast('创建失败:' + e.message); } }, - async deleteSession(id) { - if (!confirm('删除会话?')) return; - const delDir = confirm('同时删除任务目录(文件将不可恢复)?\n取消 = 仅删除会话记录'); + deleteSession(id) { + state.pendingDeleteId = id; + $('del-dir-check').checked = false; + $('delete-modal-text').textContent = '确定删除会话 ' + id + '?'; + $('delete-modal').classList.remove('hidden'); + }, + closeDelete() { + $('delete-modal').classList.add('hidden'); + state.pendingDeleteId = null; + }, + async confirmDelete() { + const id = state.pendingDeleteId; + if (!id) return; + const delDir = $('del-dir-check').checked; + this.closeDelete(); try { await req('DELETE', '/api/sessions/' + id + '?delete_dir=' + (delDir ? 'true' : 'false')); if (state.sessionId === id) this.backToList();