0b2d7ac50d
脚本 exec 立即返回 running 并在后台跑批次;/ws/alerts 推送 script_progress/complete; 新增 ScriptRunsPage、Telegram 汇总通知与可配置的浏览器完成提示音。 Co-authored-by: Cursor <cursoragent@cursor.com>
2.1 KiB
2.1 KiB
2026-06-08 — 脚本执行:全局进度 + 看板 + Telegram 汇总
摘要
脚本批量执行改为真后台(API 立即返回 running);扩展 /ws/alerts 推送 script_progress / script_complete;全局顶栏进度条与完成 Alert+提示音;新建「脚本看板」页;Telegram 仅发成功/失败汇总与看板深链。
动机
366 台同步执行阻塞 HTTP 请求;用户需跨页面查看进度;失败明细应在看板而非 Telegram 长列表。
涉及文件
后端
server/application/services/script_service.py—asyncio后台批次server/application/services/script_execution_notify.py— WS + Telegram 编排server/application/services/script_job_callback.py— 长任务终态通知server/infrastructure/redis/script_execution_store.py—execution_progress_statsserver/api/websocket.py—broadcast_script_progress/completeserver/infrastructure/telegram/__init__.py—send_telegram_script_summaryserver/config.py/server/api/settings.py—NOTIFY_SCRIPT_COMPLETE
前端
frontend/src/composables/useScriptExecutionQueue.tsfrontend/src/composables/useWebSocket.tsfrontend/src/App.vue— 全局进度与完成 Alertfrontend/src/pages/ScriptRunsPage.vue— 第 15 页frontend/src/pages/ScriptsPage.vue— 移除页内批量状态面板frontend/src/router/index.ts/frontend/src/types/api.ts
文档
docs/project/nexus-functional-development-guide.md— 15 页 SSOTdocs/changelog/2026-06-08-script-exec-global-progress-board.mddocs/audit/2026-06-08-script-exec-global-progress-board.md
迁移 / 重启
- 无需 DB 迁移
- 需重启 API worker;前端
vite build后部署web/app/ - 可选:在设置中配置
notify_script_complete
验证
pytest tests/test_script_execution_progress_stats.py tests/test_exec_detail_grouping.py -q
cd frontend && npm run build
bash scripts/local_verify.sh
- 提交执行后 1s 内对话框关闭,顶栏显示「已进行 X 台,剩余 Y 台」
- 结束:提示音 + Alert,Telegram 仅汇总 +
#/script-runs/{id}链接 - WS 断线:3s 轮询直至终态