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