feat(file-check): 新增文件检核相关 API 和工具,替换 RoHS 检核功能
This commit is contained in:
1 parent
fa0cdee8df
commit
24310b63b3
35 files changed
+3066
-659
No files matched your search
@@ -83,7 +83,8 @@ Scope 应对齐代码模块,便于从提交信息定位到目录。选取规
|
||||
| --- | --- |
|
||||
| `schedule` | `services/schedule/`、`api/schedule_admin`、前端 `features/admin/modules/schedules/` |
|
||||
| `shipping-notice` | `services/shipping_notice/`、`api/workspace_shipping_notice` |
|
||||
| `rohs-check` | `services/rohs_check*`、`api/rohs_check_tools` |
|
||||
| `file-check` | `services/file_check*`、`api/file_check_tools` |
|
||||
| `rohs-check` | RoHS 实例(历史 scope,新改动请用 `file-check`) |
|
||||
| `knowledge-base` | `api/knowledge_base`、`services/knowledge_cleaning/` |
|
||||
| `chat` | `api/chat`、前端 chat 相关 |
|
||||
| `auth` | 登录认证 |
|
||||
|
||||
+6
-7
@@ -22,14 +22,13 @@
|
||||
|
||||
## 3. 范围说明
|
||||
|
||||
### 3.x RoHS 文件检核补充需求
|
||||
### 3.x 文件检核(file_check)补充需求
|
||||
|
||||
- **核心目标**:提供 RoHS 文件检核能力(发起检核、查询实时结果、获取报告、可选同步知识库、基于知识库查询历史报告)。对用户统一称为「检核」,不区分排程触发与对话触发等实现方式。
|
||||
- 新增 `RoHSCheckService` 作为统一判定入口,内部复用现有 Dify RoHS Workflow 中的 Prompt 与模型配置。
|
||||
- 新增 Dify Chatflow 显式 HTTP Tool,用于对话中发起检核、查询检核状态与展示结果;不使用 Agent 节点做逐条判定。
|
||||
- 检核成功或部分成功并生成 Excel 报告后,可按配置自动同步到指定知识库分组;Chatflow 通过 Knowledge Retrieval 检索已入库历史报告(与 Tool API 实时查询并存)。
|
||||
- 后台执行、定时触发、数据抓取与写回沿用现有任务引擎(实现细节对用户透明)。
|
||||
- Dify Chatflow 编排与 OpenAPI 导入见 [docs/rohs_chatflow_guide.md](rohs_chatflow_guide.md)。
|
||||
- **核心目标**:提供通用文件检核能力(发起检核、查询实时结果、获取报告、可选同步知识库、基于知识库查询历史报告)。对用户统一称为「检核」,不区分排程触发与对话触发等实现方式。
|
||||
- **通用域**:`FileCheckService` + `/api/file-check` Tool API + 单套 Dify Chatflow「文件检核助手」;RoHS、MSDS 等差异仅在排程 SQL、`task_id` 与判定 Workflow。
|
||||
- **多 Agent**:RoHS / MSDS 等工作台 Agent 共用同一 `dify_app_id`,HXOPS 按 `extra_config.tool_run_progress.schedule_task_id` 注入 `task_id`。
|
||||
- 检核成功或部分成功并生成 Excel 报告后,可按配置自动同步到指定知识库分组;Chatflow 历史分支按 `task_id` 选择知识库 Dataset。
|
||||
- Dify Chatflow 编排与 OpenAPI 导入见 [docs/file_check_chatflow_guide.md](file_check_chatflow_guide.md)。
|
||||
|
||||
### 3.1 本期范围
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+11
-4
@@ -16,14 +16,21 @@
|
||||
|
||||
## 2. 详细功能拆分
|
||||
|
||||
### RoHS 文件检核
|
||||
### 文件检核(通用域)
|
||||
|
||||
| 功能项 | 状态 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| RoHSCheckService 判定入口 | 已实现 | 检核执行链路统一调用,内部复用现有 Dify Workflow |
|
||||
| Chatflow 发起与查询检核 | 已实现 | Tool API:查检核任务、启动检核、查检核批次、查最近检核、Excel 报告链接 |
|
||||
| RoHS Chatflow 编排手册 | 已文档化 | 见 [docs/rohs_chatflow_guide.md](rohs_chatflow_guide.md) |
|
||||
| FileCheckService 判定入口 | 已实现 | 检核执行链路统一调用 Dify Workflow(RoHS / MSDS 等按排程绑定不同 Workflow) |
|
||||
| 文件检核 Chatflow Tool API | 已实现 | `/api/file-check/tools/*`:启动检核、查批次、Excel 报告链接 |
|
||||
| 文件检核 Chatflow 编排手册 | 已文档化 | 见 [docs/file_check_chatflow_guide.md](file_check_chatflow_guide.md) |
|
||||
| 检核报告同步知识库 | 已实现 | 检核 success / partial_failed 且生成 Excel 后同步到所选知识库分组 |
|
||||
| 多 Agent 共用 Chatflow | 已实现 | RoHS / MSDS 等 Agent 共用同一 Dify Chatflow,`task_id` 由 Agent extra_config 注入 |
|
||||
|
||||
### RoHS 文件检核(实例)
|
||||
|
||||
| 功能项 | 状态 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| RoHS 排程检核 | 已实现 | 首个文件检核类型实例,复用通用 file_check 域 |
|
||||
|
||||
### F-01 本人假期查询
|
||||
|
||||
|
||||
@@ -0,0 +1,724 @@
|
||||
{
|
||||
"openapi": "3.0.3",
|
||||
"info": {
|
||||
"title": "HXOPS File Check Tool API",
|
||||
"description": "文件检核 Chatflow 显式 HTTP Tool API:检核任务列表、发起检核、查询检核批次、下载检核报告。鉴权:Authorization Bearer 或 X-Integration-Key。",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "http://192.168.36.108:5052",
|
||||
"description": "HXOPS_TOOLS_API_BASE"
|
||||
}
|
||||
],
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
},
|
||||
{
|
||||
"IntegrationKey": []
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/api/file-check/tools/tasks": {
|
||||
"get": {
|
||||
"operationId": "list_file_check_tasks",
|
||||
"summary": "查询指定文件检核任务",
|
||||
"tags": [
|
||||
"File Check"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "task_id",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"example": 12
|
||||
},
|
||||
"description": "检核任务 ID(Agent 绑定的 schedule_task_id)"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ListTasksResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/components/responses/BadRequest"
|
||||
},
|
||||
"401": {
|
||||
"$ref": "#/components/responses/Unauthorized"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/components/responses/TaskNotFound"
|
||||
},
|
||||
"503": {
|
||||
"$ref": "#/components/responses/MissingAuth"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/file-check/tools/tasks/run": {
|
||||
"post": {
|
||||
"operationId": "run_file_check",
|
||||
"summary": "异步启动 文件检核",
|
||||
"tags": [
|
||||
"File Check"
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/RunCheckRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "启动成功;或已有 文件检核进行中,返回 ok=false/error_code=check_running",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/RunCheckSuccessResponse"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/CheckRunningResponse"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/components/responses/BadRequest"
|
||||
},
|
||||
"401": {
|
||||
"$ref": "#/components/responses/Unauthorized"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/components/responses/TaskNotFound"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/file-check/tools/runs": {
|
||||
"get": {
|
||||
"operationId": "list_file_check_runs",
|
||||
"summary": "查询 文件检核批次列表",
|
||||
"tags": [
|
||||
"File 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/file-check/tools/runs/{run_id}": {
|
||||
"get": {
|
||||
"operationId": "get_file_check_run",
|
||||
"summary": "查询指定检核批次",
|
||||
"tags": [
|
||||
"File Check"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "run_id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"example": 88
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/GetRunResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"$ref": "#/components/responses/Unauthorized"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/components/responses/RunNotFound"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/file-check/tools/tasks/{task_id}/latest-run": {
|
||||
"get": {
|
||||
"operationId": "get_latest_file_check_run",
|
||||
"summary": "查询检核任务最近一次检核",
|
||||
"tags": [
|
||||
"File Check"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "task_id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"example": 12
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/GetRunResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"$ref": "#/components/responses/Unauthorized"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/components/responses/RunNotFound"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/file-check/tools/runs/{run_id}/excel": {
|
||||
"get": {
|
||||
"operationId": "download_file_check_run_excel",
|
||||
"summary": "下载检核报告 Excel(短期签名 token)",
|
||||
"tags": [
|
||||
"File Check"
|
||||
],
|
||||
"security": [],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "run_id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"example": 88
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "token",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"description": "由 get_file_check_run 返回的 excel.download_url 中的 JWT,有效期 600 秒",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Excel 文件流",
|
||||
"content": {
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"format": "binary"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"$ref": "#/components/responses/ExcelNotReady"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"securitySchemes": {
|
||||
"BearerAuth": {
|
||||
"type": "http",
|
||||
"scheme": "bearer",
|
||||
"description": "FILE_CHECK_TOOLS_API_KEY 或 INTEGRATION_API_KEY"
|
||||
},
|
||||
"IntegrationKey": {
|
||||
"type": "apiKey",
|
||||
"in": "header",
|
||||
"name": "X-Integration-Key",
|
||||
"description": "与 Bearer 二选一"
|
||||
}
|
||||
},
|
||||
"schemas": {
|
||||
"TaskSummary": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_id": {
|
||||
"type": "integer",
|
||||
"example": 12
|
||||
},
|
||||
"task_no": {
|
||||
"type": "string",
|
||||
"example": "CHK202606090001"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "文件自动检核"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"last_status": {
|
||||
"type": "string",
|
||||
"nullable": true,
|
||||
"example": "success"
|
||||
},
|
||||
"last_run_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"nullable": true
|
||||
},
|
||||
"next_run_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"RunExcel": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"file_name": {
|
||||
"type": "string",
|
||||
"nullable": true,
|
||||
"example": "RUN202606090001.xlsx"
|
||||
},
|
||||
"file_size": {
|
||||
"type": "integer",
|
||||
"nullable": true,
|
||||
"example": 45678
|
||||
},
|
||||
"download_url": {
|
||||
"type": "string",
|
||||
"nullable": true,
|
||||
"example": "https://your-hxops-host/api/file-check/tools/runs/88/excel?token=..."
|
||||
}
|
||||
}
|
||||
},
|
||||
"RunKnowledgeBase": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"sync_status": {
|
||||
"type": "string",
|
||||
"nullable": true,
|
||||
"enum": [
|
||||
"skipped",
|
||||
"queued",
|
||||
"cleaning",
|
||||
"syncing",
|
||||
"ready",
|
||||
"success",
|
||||
"failed"
|
||||
]
|
||||
},
|
||||
"group_id": {
|
||||
"type": "integer",
|
||||
"nullable": true
|
||||
},
|
||||
"document_id": {
|
||||
"type": "integer",
|
||||
"nullable": true
|
||||
},
|
||||
"document_version_id": {
|
||||
"type": "integer",
|
||||
"nullable": true
|
||||
},
|
||||
"sync_job_id": {
|
||||
"type": "integer",
|
||||
"nullable": true
|
||||
},
|
||||
"error_message": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"RunDetail": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"run_id": {
|
||||
"type": "integer",
|
||||
"example": 88
|
||||
},
|
||||
"run_no": {
|
||||
"type": "string",
|
||||
"example": "RUN202606090001"
|
||||
},
|
||||
"task_id": {
|
||||
"type": "integer",
|
||||
"example": 12
|
||||
},
|
||||
"task_name": {
|
||||
"type": "string",
|
||||
"example": "文件自动检核"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"running",
|
||||
"success",
|
||||
"partial_failed",
|
||||
"failed",
|
||||
"queued",
|
||||
"cancelled"
|
||||
]
|
||||
},
|
||||
"total_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"success_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"failed_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"skipped_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"started_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"nullable": true
|
||||
},
|
||||
"finished_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"nullable": true
|
||||
},
|
||||
"duration_ms": {
|
||||
"type": "integer",
|
||||
"nullable": true
|
||||
},
|
||||
"error_message": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"excel": {
|
||||
"$ref": "#/components/schemas/RunExcel"
|
||||
},
|
||||
"knowledge_base": {
|
||||
"$ref": "#/components/schemas/RunKnowledgeBase"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ListTasksResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"ok",
|
||||
"tasks"
|
||||
],
|
||||
"properties": {
|
||||
"ok": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"tasks": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/TaskSummary"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"RunCheckRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_id": {
|
||||
"type": "integer",
|
||||
"example": 12
|
||||
},
|
||||
"trigger_source": {
|
||||
"type": "string",
|
||||
"default": "dify_chatflow"
|
||||
},
|
||||
"conversation_id": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"user_message": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"task_id"
|
||||
],
|
||||
"description": "Chatflow Tool 节点绑定 task_id(来自 Start 用户输入);user_message 用于进度卡片 turn 匹配"
|
||||
},
|
||||
"RunCheckSuccessResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"ok",
|
||||
"message",
|
||||
"run"
|
||||
],
|
||||
"properties": {
|
||||
"ok": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"example": "检核已启动"
|
||||
},
|
||||
"run": {
|
||||
"$ref": "#/components/schemas/RunDetail"
|
||||
}
|
||||
}
|
||||
},
|
||||
"CheckRunningResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"ok",
|
||||
"error_code",
|
||||
"message",
|
||||
"run"
|
||||
],
|
||||
"properties": {
|
||||
"ok": {
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"error_code": {
|
||||
"type": "string",
|
||||
"example": "check_running"
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"example": "该检核任务正在执行中,请稍后查询结果"
|
||||
},
|
||||
"run": {
|
||||
"$ref": "#/components/schemas/RunDetail"
|
||||
}
|
||||
}
|
||||
},
|
||||
"GetRunResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"ok",
|
||||
"run"
|
||||
],
|
||||
"properties": {
|
||||
"ok": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"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"
|
||||
],
|
||||
"properties": {
|
||||
"ok": {
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"error_code": {
|
||||
"type": "string"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"Unauthorized": {
|
||||
"description": "鉴权失败",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
},
|
||||
"examples": {
|
||||
"missing_auth": {
|
||||
"value": {
|
||||
"ok": false,
|
||||
"error_code": "missing_auth",
|
||||
"message": "missing_auth"
|
||||
}
|
||||
},
|
||||
"invalid_auth": {
|
||||
"value": {
|
||||
"ok": false,
|
||||
"error_code": "invalid_auth",
|
||||
"message": "invalid_auth"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"MissingAuth": {
|
||||
"description": "服务端未配置 FILE_CHECK_TOOLS_API_KEY / INTEGRATION_API_KEY",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
},
|
||||
"example": {
|
||||
"ok": false,
|
||||
"error_code": "missing_auth",
|
||||
"message": "FILE_CHECK_TOOLS_API_KEY or INTEGRATION_API_KEY is not configured"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"BadRequest": {
|
||||
"description": "请求参数无效",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
},
|
||||
"example": {
|
||||
"ok": false,
|
||||
"error_code": "invalid_request",
|
||||
"message": "invalid_request"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"TaskNotFound": {
|
||||
"description": "检核任务不存在",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
},
|
||||
"example": {
|
||||
"ok": false,
|
||||
"error_code": "task_not_found",
|
||||
"message": "task_not_found"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"RunNotFound": {
|
||||
"description": "检核批次不存在",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
},
|
||||
"example": {
|
||||
"ok": false,
|
||||
"error_code": "run_not_found",
|
||||
"message": "run_not_found"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ExcelNotReady": {
|
||||
"description": "Excel 尚未生成",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
},
|
||||
"example": {
|
||||
"ok": false,
|
||||
"error_code": "excel_not_ready",
|
||||
"message": "excel_not_ready"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -10,13 +10,13 @@
|
||||
|
||||
## 2. 现有可复用能力
|
||||
|
||||
### 2.x RoHS 文件检核可复用能力
|
||||
### 2.x 文件检核(file_check)可复用能力
|
||||
|
||||
- **产品语义**:对外统一为 RoHS 文件检核(发起、实时查询、报告、知识库同步、历史报告检索);Tool API 使用 `/api/rohs-check/tools/tasks` 与 `task_id` / `task_no` 字段;历史查询走 Dify Knowledge Retrieval(绑定检核报告同步的 Dataset);对外基地址由环境变量 `HXOPS_TOOLS_API_BASE` 配置。
|
||||
- 通过 `RoHSCheckService.evaluate()` 包装现有 Dify Workflow 调用,保持 `dify_result / dify_message` 输出兼容。
|
||||
- 新增 `/api/rohs-check/tools/*` 显式 HTTP Tool API,供 Dify Chatflow 发起检核、查询检核结果并返回 Excel 报告短期签名链接。
|
||||
- Chatflow 完整编排、Dify 逐步配置与 OpenAPI 导入见 **[docs/rohs_chatflow_guide.md](rohs_chatflow_guide.md)**;OpenAPI 规范见 **[docs/openapi/rohs_check_tools_openapi.json](openapi/rohs_check_tools_openapi.json)**(`python backend/scripts/export_rohs_check_openapi.py` 重新生成)。
|
||||
- 复用知识库 `KbDocument / KbDocumentVersion / KbJob` 清洗与 Dify 同步链路,将检核报告 Excel 作为独立文档入库。
|
||||
- **产品语义**:对外统一为文件检核(RoHS / MSDS 等);Tool API 使用 `/api/file-check/tools/tasks` 与 `task_id` 字段;多 Agent 共用单套 Dify Chatflow,`task_id` 由 Agent `extra_config` 注入;历史查询按 `task_id` 分支走 Dify Knowledge Retrieval。
|
||||
- 通过 `FileCheckService.evaluate()` 调用排程绑定的 Dify Workflow,保持 `dify_result / dify_message` 输出兼容。
|
||||
- `/api/file-check/tools/*` 显式 HTTP Tool API,供 Chatflow 发起检核、查询结果并返回 Excel 短期签名链接。
|
||||
- Chatflow 编排见 **[docs/file_check_chatflow_guide.md](file_check_chatflow_guide.md)**;OpenAPI 见 **[docs/openapi/file_check_tools_openapi.json](openapi/file_check_tools_openapi.json)**(`python backend/scripts/export_file_check_openapi.py`)。
|
||||
- 复用知识库清洗与 Dify 同步链路,将检核报告 Excel 入库。
|
||||
|
||||
### 2.1 已有聊天路由能力
|
||||
|
||||
|
||||
Reference in new issue
Block a user