feat(web): Phase 3 - Web 端治理平台(FastAPI + Vue 3)
把工作流包装成浏览器化的产品:填表 → 测试连接 → 一键治理 → 实时进度。
核心架构
- web/app.py FastAPI 入口 + CORS + 静态资源挂载
- web/start.py 启动前依赖检查(可选 anthropic / dmPython)
- web/start.bat Windows 一键启动脚本
- web/api/routes.py 12 个 REST 接口(jobs/history/standards/reports...)
调度与运行
- web/core/orchestrator.py 8 步流程调度 + 步骤级日志 + 异常 traceback
- web/core/job_manager.py 后台任务管理 + LogBuffer + SSE 订阅
- web/core/db_adapter.py MySQL / 达梦 统一连接与查询
- web/core/step_impl/ 8 个 Step 的 Web 版实现
LLM 增强(可降级)
- web/core/llm.py Anthropic / OpenAI / MiniMax 多 provider 适配
- configs/llm.example.yaml provider / api_key / base_url / model 模板
SQL 模板体系(Python 不再写 SQL)
- web/sql/info_schema/ list_columns / list_tables 按 dialect 区分 MySQL / 达梦
- web/sql/verify/ count_table_rows
- web/sql/empty_fields/ count_with_nulls
- web/sql/xzqh/ check_dict_table_exists / find_xzqh_orphans
- web/sql/standards/ sample_field_values
- web/sql/health/ check_connection
- web/sql/loader.py 占位符 + dialect 自动加载
前端(无构建步骤)
- web/static/index.html Vue 3 单页应用
- web/static/lib/ Vue + Element Plus 静态资源
- web/static/style.css
实时日志 / 历史归档 / 报告下载
- SSE 流(GET /api/jobs/{id}/logs/stream)
- outputs/<db>/<ts>/findings/_all_findings.json
- outputs/<db>/<ts>/reports/{md,docx}
- GET /api/history /api/reports/{db}/{ts}/{file}
调试能力(本次一并落地)
- 三路日志:SSE 实时流 + web/logs/app.log + outputs/<db>/<ts>/run.log
- 每步开始 / 完成带耗时、进度 N/M;异常带 traceback 与异常类型
- 数据库 [DB] 连接 / SQL 执行时间;路由 [POST /api/xxx] 入参摘要
- 启动脚本自带 web/logs/start.log
Why:CLI 工作流需要登录机器;Web 端把治理入口放到任何能开浏览器的设备上,
配合 SSE 实时反馈,业务方也能直接用。
How:复用 workflow/ 中的 8 步逻辑与 standards/ 国标插件;新增 Pydantic 契约
+ job_manager + SSE,前后端用 REST + 事件流通信。
Showing
web/README.md
0 → 100644
web/__init__.py
0 → 100644
web/api/__init__.py
0 → 100644
web/api/routes.py
0 → 100644
web/app.py
0 → 100644
web/configs/defaults.yaml
0 → 100644
web/configs/llm.example.yaml
0 → 100644
web/core/__init__.py
0 → 100644
web/core/db_adapter.py
0 → 100644
web/core/job_manager.py
0 → 100644
web/core/llm.py
0 → 100644
web/core/models.py
0 → 100644
web/core/orchestrator.py
0 → 100644
web/docs/DESIGN.md
0 → 100644
web/logs/.gitkeep
0 → 100644
web/requirements.txt
0 → 100644
web/sql/README.md
0 → 100644
web/sql/loader.py
0 → 100644
web/start.bat
0 → 100644
web/start.py
0 → 100644
web/static/index.html
0 → 100644
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
web/static/style.css
0 → 100644
Please register or sign in to comment