diff --git a/app/server/public/css/style.css b/app/server/public/css/style.css index 9f81b89..3b0420f 100644 --- a/app/server/public/css/style.css +++ b/app/server/public/css/style.css @@ -75,25 +75,14 @@ body { .badge.queued { background: #fff4dc; color: #a06a00; } .badge.completed { background: #eceff5; color: #5c6674; } .badge.cancelled { background: #fdecea; color: #b3382c; } -.badge.execution { background: #e8ecfd; color: #3550b8; } .session-del { color: #c33; background: none; border: none; font-size: 12px; padding: 6px; } -/* ---- 阶段开关条 ---- */ +/* ---- 任务状态栏 ---- */ .phase-bar { - display: flex; align-items: center; justify-content: space-between; + display: flex; align-items: center; padding: 8px 12px; background: #fff; border-bottom: 1px solid #e8e8ee; } .status-pill { font-size: 12px; color: #666; } -.phase-switch { - border: none; border-radius: 18px; padding: 8px 18px; - font-size: 14px; font-weight: 600; color: #fff; cursor: pointer; - box-shadow: inset 0 -2px 0 rgba(0,0,0,0.18); - transition: background 0.2s; -} -.phase-switch.planning { background: #2e9d54; } -.phase-switch.planning:active { background: #268547; } -.phase-switch.execution { background: #d2483c; } -.phase-switch.execution:active { background: #b13a2f; } /* ---- 消息 ---- */ .messages { diff --git a/app/server/public/index.html b/app/server/public/index.html index 5878849..c97b494 100644 --- a/app/server/public/index.html +++ b/app/server/public/index.html @@ -45,10 +45,9 @@ - +
-- -
diff --git a/app/server/public/js/app.js b/app/server/public/js/app.js index 5954c9f..90b5a2a 100644 --- a/app/server/public/js/app.js +++ b/app/server/public/js/app.js @@ -8,7 +8,6 @@ if (typeof marked !== 'undefined') { const state = { sessionId: null, - phase: 'planning', status: '', es: null, streamEl: null, @@ -120,11 +119,10 @@ async function loadSessions() { el.innerHTML = rows.map(s => { const st = { queued: '排队中', active: '活跃中', completed: '已完成', cancelled: '已终止' }[s.status] || s.status; const badge = '' + st + (s.status === 'queued' && s.queue_pos ? ' #' + s.queue_pos : '') + ''; - const phase = s.phase === 'execution' ? '执行中阶段' : ''; return '
' + '
' + '
' + esc(s.title || s.id) + '
' + - '
' + esc(s.id) + '' + badge + phase + + '
' + esc(s.id) + '' + badge + (s.model_id ? '' + esc(s.model_id) + '' : '') + '
' + '
' + '' + @@ -217,7 +215,6 @@ async function renderDetail(detail) { state.streamText = ''; state.toolCards = {}; const s = detail.session; - state.phase = s.phase; state.status = s.status; updatePhaseUI(); $('chat-title').textContent = s.title || s.id; @@ -227,7 +224,7 @@ async function renderDetail(detail) { if (m.role === 'assistant') appendToolCardsFromAssistant(m, box); } if (!detail.messages.length) { - box.innerHTML = '
描述你的需求,AI 会先和你讨论(规划阶段)。
'; + box.innerHTML = '
描述你的需求,AI 会和你讨论并直接干活。
'; } scrollBottom(); loadFiles(); @@ -246,13 +243,8 @@ function connectStream() { es.addEventListener('status', ev => { const d = JSON.parse(ev.data); state.status = d.status; - state.phase = d.phase; updatePhaseUI(d); }); - es.addEventListener('phase', ev => { - state.phase = JSON.parse(ev.data).phase; - updatePhaseUI(); - }); es.addEventListener('assistant_delta', ev => { const d = JSON.parse(ev.data); if (!state.streamEl) { @@ -312,25 +304,16 @@ function connectStream() { }); } -// ---------- 阶段开关 ---------- +// ---------- 任务状态 ---------- function updatePhaseUI(d) { - const btn = $('phase-switch'); const pill = $('status-pill'); const stMap = { queued: '排队中', active: '活跃中', completed: '已完成', cancelled: '已终止' }; let text = stMap[state.status] || state.status || '--'; if (d && d.queue_pos) text += '(第 ' + d.queue_pos + ' 位)'; if (state.status === 'active') { - const run = d && d.running; - text = '活跃中 · ' + (state.phase === 'execution' ? '执行' : '规划') + (d && d.model_id ? ' · ' + d.model_id : ''); + text = '活跃中' + (d && d.model_id ? ' · ' + d.model_id : ''); } pill.textContent = text; - if (state.phase === 'execution') { - btn.textContent = '■ 终止'; - btn.className = 'phase-switch execution'; - } else { - btn.textContent = '▶ 开始执行'; - btn.className = 'phase-switch planning'; - } } // ---------- 文件 ---------- @@ -340,7 +323,7 @@ async function loadFiles() { const files = await req('GET', '/api/sessions/' + state.sessionId + '/files'); const el = $('files-list'); if (!files.length) { - el.innerHTML = '
还没有文件。上传文件或在执行阶段让 AI 生成。
'; + el.innerHTML = '
还没有文件。上传文件或在对话中让 AI 生成。
'; return; } el.innerHTML = files.map(f => { @@ -423,26 +406,6 @@ const ui = { scrollBottom(); } catch (e) { toast('发送失败:' + e.message); } }, - async togglePhase() { - if (!state.sessionId) return; - try { - if (state.phase === 'planning') { - await req('POST', '/api/sessions/' + state.sessionId + '/start'); - state.phase = 'execution'; - updatePhaseUI(); - const box = $('messages'); - const wrap = document.createElement('div'); - wrap.className = 'msg me'; - wrap.innerHTML = '
我(开始执行)
' + - '
我说完了,你可以开始干活了。先把我上面说的需求整理成 task.md 文件写入任务目录,然后按照 task.md 开始执行。
'; - box.appendChild(wrap); - scrollBottom(); - } else { - await req('POST', '/api/sessions/' + state.sessionId + '/stop'); - toast('已发送终止指令'); - } - } catch (e) { toast('操作失败:' + e.message); } - }, toggleFiles() { state.filePanelOpen = !state.filePanelOpen; $('files-panel').classList.toggle('hidden', !state.filePanelOpen);