MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / handleBatchRegistration

Function handleBatchRegistration

static/js/app.js:1459–1499  ·  view source on GitHub ↗
(requestData)

Source from the content-addressed store, hash-verified

1457
1458// 批量注册
1459async function handleBatchRegistration(requestData) {
1460 // 重置批量任务状态
1461 batchCompleted = false;
1462 batchFinalStatus = null;
1463 displayedLogs.clear(); // 清空日志去重集合
1464 toastShown = false; // 重置 toast 标志
1465
1466 const count = parseInt(elements.batchCount.value) || 5;
1467 const intervalMin = parseInt(elements.intervalMin.value) || 5;
1468 const intervalMax = parseInt(elements.intervalMax.value) || 30;
1469 const concurrency = parseInt(elements.concurrencyCount.value) || 3;
1470 const mode = elements.concurrencyMode.value || 'pipeline';
1471
1472 requestData.count = count;
1473 requestData.interval_min = intervalMin;
1474 requestData.interval_max = intervalMax;
1475 requestData.concurrency = Math.min(50, Math.max(1, concurrency));
1476 requestData.mode = mode;
1477
1478 addLog('info', `[系统] 正在启动批量注册任务 (数量: ${count})...`);
1479
1480 try {
1481 const data = await api.post('/registration/batch', requestData);
1482
1483 currentBatch = { ...data, pollingMode: 'batch' };
1484 activeBatchId = data.batch_id; // 保存用于重连
1485 // 持久化到 sessionStorage,跨页面导航后可恢复
1486 sessionStorage.setItem('activeTask', JSON.stringify({ batch_id: data.batch_id, mode: 'batch', total: data.count }));
1487 addLog('info', `[系统] 批量任务已创建: ${data.batch_id}`);
1488 addLog('info', `[系统] 共 ${data.count} 个任务已加入队列`);
1489 showBatchStatus(data);
1490
1491 // 优先使用 WebSocket
1492 connectBatchWebSocket(data.batch_id);
1493
1494 } catch (error) {
1495 addLog('error', `[错误] 启动失败: ${error.message}`);
1496 toast.error(error.message);
1497 resetButtons();
1498 }
1499}
1500
1501// 取消任务
1502async function handleCancelTask() {

Callers 1

handleStartRegistrationFunction · 0.85

Calls 6

addLogFunction · 0.85
showBatchStatusFunction · 0.85
connectBatchWebSocketFunction · 0.85
resetButtonsFunction · 0.85
errorMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected