MCPcopy
hub / github.com/IPADS-SAI/MobiAgent / toggleSuspend

Function toggleSuspend

collect/manual/static/js/script.js:286–323  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

284
285// 人工介入模式切换
286async function toggleSuspend() {
287 if (!isCollecting) {
288 updateStatus('请先开始数据收集', 'error');
289 return;
290 }
291
292 try {
293 const response = await fetch('/suspend', {
294 method: 'POST',
295 headers: {
296 'Content-Type': 'application/json'
297 }
298 });
299
300 if (response.ok) {
301 const result = await response.json();
302 isSuspended = result.is_suspended;
303
304 const suspendBtn = document.getElementById('suspendBtn');
305
306 if (isSuspended) {
307 suspendBtn.classList.add('suspended');
308 suspendBtn.textContent = '✅ 人工介入中';
309 updateStatus('✋ 人工介入模式已启动 - 后续操作将不被记录,直到您点击此按钮关闭', 'warning');
310 } else {
311 suspendBtn.classList.remove('suspended');
312 suspendBtn.textContent = '🚫 人工介入';
313 updateStatus('✅ 人工介入模式已关闭 - 操作将继续被记录', 'success');
314 }
315 } else {
316 const error = await response.json();
317 updateStatus(`人工介入切换失败: ${error.detail}`, 'error');
318 }
319 } catch (error) {
320 console.error('人工介入切换错误:', error);
321 updateStatus(`人工介入切换错误: ${error.message}`, 'error');
322 }
323}
324
325// 检查并同步suspend状态
326async function checkSuspendStatus() {

Callers

nothing calls this directly

Calls 2

updateStatusFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected