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();