恢复终止能力:状态胶囊旁新增小号「终止」链接(仅活跃中显示),点击调 /stop;updatePhaseUI 按状态显隐

This commit is contained in:
2026-08-31 14:14:45 +08:00
parent ecbe6f1825
commit 3a6ee033c5
3 changed files with 15 additions and 0 deletions
+5
View File
@@ -83,6 +83,11 @@ body {
padding: 8px 12px; background: #fff; border-bottom: 1px solid #e8e8ee;
}
.status-pill { font-size: 12px; color: #666; }
.stop-link {
background: none; border: none; cursor: pointer;
color: #c33; font-size: 12px; padding: 2px 6px; margin-left: 2px;
}
.stop-link:active { opacity: 0.6; }
/* ---- 消息 ---- */
.messages {
+1
View File
@@ -48,6 +48,7 @@
<!-- 任务状态栏 -->
<div class="phase-bar" id="phase-bar">
<span class="status-pill" id="status-pill">--</span>
<button class="stop-link hidden" id="stop-btn" onclick="ui.stopSession()">终止</button>
</div>
<div class="messages" id="messages"></div>
+9
View File
@@ -314,6 +314,8 @@ function updatePhaseUI(d) {
text = '活跃中' + (d && d.model_id ? ' · ' + d.model_id : '');
}
pill.textContent = text;
// 仅活跃中提供终止入口
$('stop-btn').classList.toggle('hidden', state.status !== 'active');
}
// ---------- 文件 ----------
@@ -411,6 +413,13 @@ const ui = {
$('files-panel').classList.toggle('hidden', !state.filePanelOpen);
if (state.filePanelOpen) loadFiles();
},
async stopSession() {
if (!state.sessionId) return;
try {
await req('POST', '/api/sessions/' + state.sessionId + '/stop');
toast('已发送终止指令');
} catch (e) { toast('终止失败:' + e.message); }
},
async uploadFiles(ev) {
const input = ev.target;
const files = input.files;