feat(file-check): 新增历史检核报告检索功能及相关 API
This commit is contained in:
1 parent
29a7704d46
commit
f6fe56f205
16 files changed
+1060
-163
No files matched your search
@@ -2,7 +2,7 @@
|
||||
"openapi": "3.0.3",
|
||||
"info": {
|
||||
"title": "HXOPS File Check Tool API",
|
||||
"description": "文件检核 Chatflow 显式 HTTP Tool API:检核任务列表、发起检核、查询检核批次、下载检核报告。鉴权:Authorization Bearer 或 X-Integration-Key。",
|
||||
"description": "文件检核 Chatflow 显式 HTTP Tool API:检核任务列表、发起检核、查询检核批次、下载检核报告、检索历史检核报告。鉴权:Authorization Bearer 或 X-Integration-Key。",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"servers": [
|
||||
@@ -239,6 +239,50 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/file-check/tools/history/search": {
|
||||
"post": {
|
||||
"operationId": "search_file_check_history",
|
||||
"summary": "检索历史检核报告",
|
||||
"description": "按 task_id 解析 ScheduleTask → KbGroup → Dify Dataset,返回语义检索片段;供 Chatflow history_report_query 分支调用。",
|
||||
"tags": [
|
||||
"File Check"
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HistorySearchRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功(count=0 表示未命中片段)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HistorySearchResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/components/responses/BadRequest"
|
||||
},
|
||||
"401": {
|
||||
"$ref": "#/components/responses/Unauthorized"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/components/responses/TaskNotFound"
|
||||
},
|
||||
"503": {
|
||||
"$ref": "#/components/responses/MissingAuth"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/file-check/tools/runs/{run_id}/excel": {
|
||||
"get": {
|
||||
"operationId": "download_file_check_run_excel",
|
||||
@@ -596,6 +640,121 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"HistorySearchRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"task_id",
|
||||
"query"
|
||||
],
|
||||
"properties": {
|
||||
"task_id": {
|
||||
"type": "integer",
|
||||
"example": 12,
|
||||
"description": "检核任务 ID(Agent 绑定的 schedule_task_id)"
|
||||
},
|
||||
"query": {
|
||||
"type": "string",
|
||||
"example": "上周有哪些不合格项",
|
||||
"description": "用户自然语言检索问题"
|
||||
},
|
||||
"top_k": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 20,
|
||||
"default": 5,
|
||||
"description": "返回片段数,默认 5"
|
||||
},
|
||||
"score_threshold": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1,
|
||||
"default": 0.3,
|
||||
"description": "相似度阈值,默认 0.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"HistorySearchSegment": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content": {
|
||||
"type": "string",
|
||||
"description": "检索片段正文"
|
||||
},
|
||||
"score": {
|
||||
"type": "number",
|
||||
"nullable": true,
|
||||
"description": "相似度分数"
|
||||
},
|
||||
"document_id": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"document_title": {
|
||||
"type": "string",
|
||||
"nullable": true,
|
||||
"example": "RoHS检核_RUN202606090001"
|
||||
},
|
||||
"run_no": {
|
||||
"type": "string",
|
||||
"nullable": true,
|
||||
"example": "RUN202606090001"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"HistorySearchResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"ok",
|
||||
"task_id",
|
||||
"query",
|
||||
"count",
|
||||
"segments"
|
||||
],
|
||||
"properties": {
|
||||
"ok": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"task_id": {
|
||||
"type": "integer",
|
||||
"example": 12
|
||||
},
|
||||
"task_name": {
|
||||
"type": "string",
|
||||
"example": "RoHS 文件检核"
|
||||
},
|
||||
"kb_group_id": {
|
||||
"type": "integer",
|
||||
"example": 3
|
||||
},
|
||||
"kb_group_name": {
|
||||
"type": "string",
|
||||
"example": "RoHS 检核报告"
|
||||
},
|
||||
"dify_dataset_id": {
|
||||
"type": "string",
|
||||
"example": "ds-uuid"
|
||||
},
|
||||
"query": {
|
||||
"type": "string",
|
||||
"example": "上周有哪些不合格项"
|
||||
},
|
||||
"count": {
|
||||
"type": "integer",
|
||||
"example": 2
|
||||
},
|
||||
"segments": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/HistorySearchSegment"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ErrorResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
Reference in new issue
Block a user