定时任务侧边栏加上提示

This commit is contained in:
2026-09-22 17:00:46 +08:00
parent f648b811c9
commit 7aeb31f935
4 changed files with 15 additions and 5 deletions
+7
View File
@@ -733,6 +733,13 @@ footer { flex: none; padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0
position: relative; position: relative;
border-radius: 12px; border-radius: 12px;
} }
/* 定时任务会话标记:左缘紫色短竖条,绝对定位压在 conv-item 左 padding 区,不吃标题宽度;
颜色与 schedule-bar 紫色体系呼应,区别于状态色(蓝/绿/黄) */
.conv-wrap.scheduled::before {
content: ""; position: absolute; left: 2px; top: 24%; bottom: 24%;
width: 3px; border-radius: 2px; background: #7048e8;
pointer-events: none;
}
.conv-item { .conv-item {
position: relative; position: relative;
transition: background .12s; transition: background .12s;
+4 -3
View File
@@ -56,12 +56,13 @@
.stop-link.icon-only.icon-primary:hover { color: #2854d6; } .stop-link.icon-only.icon-primary:hover { color: #2854d6; }
/* 推到 phase-bar 最右侧(独立动作,与左侧状态/选择模型区分) */ /* 推到 phase-bar 最右侧(独立动作,与左侧状态/选择模型区分) */
.phase-bar .phase-bar-right { margin-left: auto; } .phase-bar .phase-bar-right { margin-left: auto; }
/* 定时任务状态条:整条可点,弹详情窗(改频次/提示词、删除;创建走 AI 的 schedule_task 工具),淡黄底区别于状态栏。 /* 定时任务状态条:整条可点,弹详情窗(改频次/提示词、删除;创建走 AI 的 schedule_task 工具),紫色调区别于状态栏;
左侧 3px 竖条与侧边栏定时任务会话的紫色标记同一语义。
高度与 phase-bar 对齐:同 6px 上下内边距,sched-text 用与 stop-link 同构的 12px 字 + 4px 上下 padding(天然同 line-box),eye 同 icon-only 钮 */ 高度与 phase-bar 对齐:同 6px 上下内边距,sched-text 用与 stop-link 同构的 12px 字 + 4px 上下 padding(天然同 line-box),eye 同 icon-only 钮 */
.schedule-bar { .schedule-bar {
flex: none; display: flex; align-items: center; gap: 8px; flex: none; display: flex; align-items: center; gap: 8px;
padding: 6px 12px; font-size: 12px; color: #8a6400; cursor: pointer; padding: 6px 12px; font-size: 12px; color: #5f3dc4; cursor: pointer;
background: #fffdf2; border-bottom: 1px solid #f0e6c8; background: #f8f5ff; border-bottom: 1px solid #e7def9; border-left: 3px solid #7048e8;
} }
.schedule-bar:active { opacity: 0.75; } .schedule-bar:active { opacity: 0.75; }
.schedule-bar .sched-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 4px 0; } .schedule-bar .sched-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 4px 0; }
+1 -1
View File
@@ -27,7 +27,7 @@
for (const s of list) { for (const s of list) {
const g = groupLabel(s.updated_at); const g = groupLabel(s.updated_at);
if (g !== lastGroup) { html += '<div class="group-label">' + esc(g) + '</div>'; lastGroup = g; } if (g !== lastGroup) { html += '<div class="group-label">' + esc(g) + '</div>'; lastGroup = g; }
html += '<div class="conv-wrap">' + html += '<div class="conv-wrap' + (s.has_schedule ? ' scheduled' : '') + '">' +
'<button class="conv-item' + (s.id === state.sessionId ? ' active' : '') + '" data-id="' + esc(s.id) + '">' + '<button class="conv-item' + (s.id === state.sessionId ? ' active' : '') + '" data-id="' + esc(s.id) + '">' +
'<span class="conv-title">' + esc(s.title || s.id) + '</span>' + drawerStatusDot(s) + '<span class="conv-title">' + esc(s.title || s.id) + '</span>' + drawerStatusDot(s) +
'</button>' + '</button>' +
+3 -1
View File
@@ -122,8 +122,10 @@ router.get('/', wrap((req, res) => {
} }
const whereSql = where.length ? ' WHERE ' + where.join(' AND ') : ''; const whereSql = where.length ? ' WHERE ' + where.join(' AND ') : '';
// has_schedule:侧边栏定时任务标记用,EXISTS 子查询单条搞定(非 N+1);schedule 详情仍只在单会话接口返回
const stmt = db.prepare( const stmt = db.prepare(
'SELECT * FROM sessions' + whereSql + ' ORDER BY updated_at DESC, id DESC LIMIT ?' 'SELECT *, EXISTS(SELECT 1 FROM scheduled_tasks t WHERE t.session_id = sessions.id) AS has_schedule FROM sessions'
+ whereSql + ' ORDER BY updated_at DESC, id DESC LIMIT ?'
); );
const rows = stmt.all.apply(stmt, args.concat([limit])); const rows = stmt.all.apply(stmt, args.concat([limit]));