refactor(backend): register ontology and orchestrator routers

- router.py: import and register ontology_router and orchestrator_router
- openapi.py: add ontology and orchestrator tags to OpenAPI documentation
- agent_runs.py: extend agent runs service with additional functionality
- test_openapi_schema.py: update OpenAPI schema tests
This commit is contained in:
caoxiaozhu
2026-05-12 01:26:13 +00:00
parent 22d47cbf2b
commit 441e27145d
4 changed files with 65 additions and 2 deletions

View File

@@ -10,6 +10,8 @@ def test_openapi_schema_includes_documented_backend_routes() -> None:
assert schema["info"]["title"] == get_settings().app_name
assert any(tag["name"] == "agent-assets" for tag in schema["tags"])
assert any(tag["name"] == "knowledge" for tag in schema["tags"])
assert any(tag["name"] == "ontology" for tag in schema["tags"])
assert any(tag["name"] == "orchestrator" for tag in schema["tags"])
agent_assets_post = schema["paths"]["/api/v1/agent-assets"]["post"]
assert agent_assets_post["summary"] == "创建 Agent 资产"
@@ -25,5 +27,13 @@ def test_openapi_schema_includes_documented_backend_routes() -> None:
assert knowledge_callback_post["summary"] == "接收 ONLYOFFICE 回调"
assert "application/json" in knowledge_callback_post["requestBody"]["content"]
ontology_parse_post = schema["paths"]["/api/v1/ontology/parse"]["post"]
assert ontology_parse_post["summary"] == "解析自然语言为语义本体"
assert "application/json" in ontology_parse_post["requestBody"]["content"]
orchestrator_run_post = schema["paths"]["/api/v1/orchestrator/run"]["post"]
assert orchestrator_run_post["summary"] == "运行 Orchestrator 统一调度"
assert "application/json" in orchestrator_run_post["requestBody"]["content"]
root_get = schema["paths"]["/"]["get"]
assert root_get["summary"] == "服务根检查"