From 7ae0de1266f88ae917faae80109e8d624953b78b Mon Sep 17 00:00:00 2001 From: kicer Date: Thu, 3 Sep 2026 15:32:01 +0800 Subject: [PATCH] =?UTF-8?q?v2:=20=E6=A0=87=E9=A2=98=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D(PATCH);=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E7=94=B1=E6=96=87=E5=AD=97=E8=83=B6=E5=9B=8A?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=BD=A9=E8=89=B2=E5=9C=86=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/server/public/css/style.css | 12 ++++++----- app/server/public/index.html | 38 +++++++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/app/server/public/css/style.css b/app/server/public/css/style.css index 6100c57..0599f58 100644 --- a/app/server/public/css/style.css +++ b/app/server/public/css/style.css @@ -327,12 +327,14 @@ footer { flex: none; padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0 } .conv-item:active { background: var(--surface); } .conv-item.active { background: var(--active-soft); color: var(--active); } -/* 会话行内状态胶囊:比状态栏版本更紧凑 */ -.conv-item .status-pill { - flex: none; font-size: 10px; line-height: 1.2; padding: 2px 7px; border-radius: 8px; - gap: 4px; +/* 会话行内状态指示:状态色圆点(排队=蓝/活跃=绿/保持=黄;活跃呼吸闪烁) */ +.conv-item .st-dot { + flex: none; width: 8px; height: 8px; border-radius: 50%; + background: var(--gray-light); } -.conv-item .status-pill::before { width: 5px; height: 5px; } +.conv-item .st-dot.queued { background: var(--active); } +.conv-item .st-dot.active { background: #1c7a2e; animation: pill-pulse 1.2s ease-in-out infinite; } +.conv-item .st-dot.held { background: #b8860b; } .drawer-empty { padding: 24px 10px; font-size: 13px; color: var(--gray-light); text-align: center; } /* 底部用户区 */ diff --git a/app/server/public/index.html b/app/server/public/index.html index a13c34a..f0707c8 100644 --- a/app/server/public/index.html +++ b/app/server/public/index.html @@ -363,8 +363,14 @@ secretary: '', vision: '', }; - c.innerHTML = - '
' + (modeIcons[state.mode] || '') + esc(state.sessionTitle || state.sessionId) + '
'; + const title = document.createElement('div'); + title.className = 'header-title'; + title.style.cursor = 'pointer'; + title.title = '点击重命名'; + title.innerHTML = (modeIcons[state.mode] || '') + esc(state.sessionTitle || state.sessionId); + title.addEventListener('click', renameSession); // 点标题重命名(同步 index) + c.innerHTML = ''; + c.appendChild(title); } // ---------- 模式切换区 ---------- @@ -628,12 +634,13 @@ return d.getFullYear() + '年' + (d.getMonth() + 1) + '月'; } - // 抽屉行状态胶囊:仅进行中的会话(排队/活跃/保持)展示,已完成/已终止不展示 + // 抽屉行状态指示:仅进行中的会话(排队/活跃/保持)展示彩色圆点,已完成/已终止不显示 const DRAWER_STATUS_TEXT = { queued: '排队中', active: '活跃中', held: '保持中' }; - function drawerPillHtml(s) { + function drawerStatusDot(s) { const st = s && s.status; - if (!DRAWER_STATUS_TEXT[st]) return ''; - return '' + DRAWER_STATUS_TEXT[st] + ''; + const label = DRAWER_STATUS_TEXT[st]; + if (!label) return ''; + return ''; } function renderDrawerList() { @@ -645,7 +652,7 @@ const g = groupLabel(s.updated_at); if (g !== lastGroup) { html += '
' + esc(g) + '
'; lastGroup = g; } html += ''; } box.innerHTML = html; @@ -733,6 +740,23 @@ updateScrollBottomBtn(); } + // ---------- 会话重命名(点击 header 标题触发;PATCH 接口,同步 index 交互) ---------- + async function renameSession() { + if (!state.sessionId) return; + const cur = state.sessionTitle || state.sessionId; + // 标题与 id 相同时(未命名)输入框留空 + const t = await promptModal('重命名会话', '输入新的会话名称', cur === state.sessionId ? '' : cur); + if (t === null) return; // 取消 + const title = String(t).trim(); + try { + await req('PATCH', '/api/sessions/' + state.sessionId, { title: title }); + toast('已重命名'); + state.sessionTitle = title; + renderHeader(); + loadSessionList(); + } catch (e) { toast('重命名失败:' + e.message); } + } + // ---------- 会话状态栏(搬自 index 的 phase-bar 功能) ---------- function updatePhaseBar(d) { const bar = $('phase-bar');