重构 API 路由并新增工作流编排功能

后端:
- 重构 agents, heartbeats, locks, meetings, resources, roles, workflows 路由
- 新增 orchestrator 和 providers 路由
- 新增 CLI 调用器和流程编排服务
- 添加日志配置和依赖项

前端:
- 更新 AgentsPage、SettingsPage、WorkflowPage 页面
- 扩展 api.ts 新增 API 接口

其他:
- 清理测试 agent 数据文件
- 新增示例工作流和项目审计报告

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude Code
2026-03-10 16:36:25 +08:00
parent 7a5a58b4e5
commit 1719d1f1f9
54 changed files with 3175 additions and 612 deletions

View File

@@ -1,7 +1,7 @@
"""
工作流管理 API 路由
"""
from fastapi import APIRouter, HTTPException
from fastapi import APIRouter, HTTPException, UploadFile, File
from pydantic import BaseModel
from typing import List, Optional, Dict, Any
from pathlib import Path
@@ -80,6 +80,28 @@ async def list_workflow_files():
return {"files": files}
@router.post("/upload")
async def upload_workflow(file: UploadFile = File(...)):
"""上传工作流 YAML 文件"""
if not file.filename or not file.filename.endswith(('.yaml', '.yml')):
raise HTTPException(status_code=400, detail="仅支持 .yaml 或 .yml 文件")
engine = get_workflow_engine()
workflow_dir = Path(engine._storage.base_path) / engine.WORKFLOWS_DIR
workflow_dir.mkdir(parents=True, exist_ok=True)
dest = workflow_dir / file.filename
content = await file.read()
dest.write_bytes(content)
return {
"success": True,
"message": f"已上传 {file.filename}",
"path": f"workflow/{file.filename}",
"size": len(content)
}
@router.get("/list")
async def list_workflows():
"""获取已加载的工作流列表"""