feat(rohs-check): 新增 RoHS 检核工具进度查询功能及相关接口
This commit is contained in:
1 parent
fee33f69d9
commit
a18a07ef1a
19 files changed
+654
-58
No files matched your search
@@ -2,7 +2,7 @@ from __future__ import annotations
|
||||
|
||||
from flask import current_app
|
||||
|
||||
from app.services.hxops_tool_api import resolve_hxops_tool_api_base
|
||||
from app.services.hxops_tool_api import resolve_HXOPS_TOOLS_API_BASE
|
||||
from app.services.rohs_check_tools.agent_resolver import is_rohs_check_chat_agent
|
||||
|
||||
# Dify Chatflow「用户输入」变量名 — 须与画布 Start 节点配置一致(见 docs/rohs_chatflow_guide.md §3.1)
|
||||
@@ -12,9 +12,9 @@ HXOPS_TOOL_API_TOKEN_INPUT = "hxops_tool_api_token"
|
||||
|
||||
def build_dify_chat_inputs() -> dict[str, str]:
|
||||
"""Build Dify chat API inputs for RoHS Chatflow HTTP nodes."""
|
||||
base = resolve_hxops_tool_api_base()
|
||||
base = resolve_HXOPS_TOOLS_API_BASE()
|
||||
key = str(
|
||||
current_app.config.get("ROHS_TOOL_API_KEY")
|
||||
current_app.config.get("ROHS_TOOLS_API_KEY")
|
||||
or current_app.config.get("INTEGRATION_API_KEY")
|
||||
or ""
|
||||
).strip()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "http://192.168.100.192:8891",
|
||||
"url": "http://192.168.100.192:8890",
|
||||
"description": "部署时设为 HXOPS_TOOLS_API_BASE;GET /tools/openapi.json 会按服务端配置自动覆盖"
|
||||
}
|
||||
],
|
||||
@@ -58,7 +58,7 @@
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "检核进行中,同任务不可重复启动",
|
||||
"description": "RoHS 检核进行中,全局不可重复启动",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/CheckRunningResponse" }
|
||||
@@ -71,6 +71,41 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/rohs-check/tools/runs": {
|
||||
"get": {
|
||||
"operationId": "list_rohs_runs",
|
||||
"summary": "查询 RoHS 检核批次列表",
|
||||
"tags": ["RoHS Check"],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "task_id",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": { "type": "integer", "example": 12 },
|
||||
"description": "可选;指定检核任务 ID 时只返回该任务批次"
|
||||
},
|
||||
{
|
||||
"name": "limit",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 },
|
||||
"description": "返回条数,最大 100"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/ListRunsResponse" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": { "$ref": "#/components/responses/Unauthorized" },
|
||||
"404": { "$ref": "#/components/responses/TaskNotFound" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/rohs-check/tools/runs/{run_id}": {
|
||||
"get": {
|
||||
"operationId": "get_rohs_run",
|
||||
@@ -165,7 +200,7 @@
|
||||
"BearerAuth": {
|
||||
"type": "http",
|
||||
"scheme": "bearer",
|
||||
"description": "ROHS_TOOL_API_KEY 或 INTEGRATION_API_KEY"
|
||||
"description": "ROHS_TOOLS_API_KEY 或 INTEGRATION_API_KEY"
|
||||
},
|
||||
"IntegrationKey": {
|
||||
"type": "apiKey",
|
||||
@@ -258,7 +293,8 @@
|
||||
"conversation_id": { "type": "string", "nullable": true },
|
||||
"user_message": { "type": "string", "nullable": true }
|
||||
},
|
||||
"description": "task_id 与 task_no 至少提供一个;优先使用 task_id"
|
||||
"required": ["task_id"],
|
||||
"description": "Chatflow Start 节点固定配置 task_id;后端仍兼容 task_no,但 RoHS Chatflow 不使用任务选择流程"
|
||||
},
|
||||
"RunCheckSuccessResponse": {
|
||||
"type": "object",
|
||||
@@ -287,6 +323,18 @@
|
||||
"run": { "$ref": "#/components/schemas/RunDetail" }
|
||||
}
|
||||
},
|
||||
"ListRunsResponse": {
|
||||
"type": "object",
|
||||
"required": ["ok", "runs", "count"],
|
||||
"properties": {
|
||||
"ok": { "type": "boolean", "example": true },
|
||||
"count": { "type": "integer", "example": 2 },
|
||||
"runs": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/components/schemas/RunDetail" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"ErrorResponse": {
|
||||
"type": "object",
|
||||
"required": ["ok", "error_code", "message"],
|
||||
@@ -315,14 +363,14 @@
|
||||
}
|
||||
},
|
||||
"MissingAuth": {
|
||||
"description": "服务端未配置 ROHS_TOOL_API_KEY / INTEGRATION_API_KEY",
|
||||
"description": "服务端未配置 ROHS_TOOLS_API_KEY / INTEGRATION_API_KEY",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/ErrorResponse" },
|
||||
"example": {
|
||||
"ok": false,
|
||||
"error_code": "missing_auth",
|
||||
"message": "ROHS_TOOL_API_KEY or INTEGRATION_API_KEY is not configured"
|
||||
"message": "ROHS_TOOLS_API_KEY or INTEGRATION_API_KEY is not configured"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user