feat(rohs-check): 新增 RoHS 检核工具 API 及相关功能
This commit is contained in:
1 parent
8a541211b7
commit
24551e9a9a
39 files changed
+3128
-189
No files matched your search
+14
-12
@@ -65,9 +65,10 @@ flask db upgrade
|
||||
### 1.2 环境变量(`.env.dev` 示例)
|
||||
|
||||
```env
|
||||
# Tool API(Dify / RPA 回调共用,可与 INTEGRATION_API_KEY 相同)
|
||||
# Tool API 基地址(RoHS / 货代共用,无尾斜杠)
|
||||
HXOPS_TOOLS_API_BASE=http://192.168.100.192:8890
|
||||
# 货代 Tool API Key(Dify / RPA 回调共用,可与 INTEGRATION_API_KEY 相同)
|
||||
SHIPPING_NOTICE_TOOL_API_KEY=your-tool-key
|
||||
SHIPPING_NOTICE_TOOL_API_BASE=http://192.168.36.114:5052
|
||||
|
||||
# 文件存储(相对 backend/ 根目录;勿写 backend/data/… 以免 cwd 在 backend/ 时变成 backend/backend/…)
|
||||
SHIPPING_NOTICE_STORAGE_ROOT=data/shipping_notice
|
||||
@@ -194,7 +195,7 @@ curl -s http://192.168.100.192:8890/api/shipping-notice/tools/openapi.json | hea
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
set SHIPPING_NOTICE_TOOL_API_BASE=http://192.168.100.192:8890
|
||||
set HXOPS_TOOLS_API_BASE=http://192.168.100.192:8890
|
||||
python scripts/export_shipping_notice_openapi.py
|
||||
# → docs/openapi/shipping_notice_tools.dify.json
|
||||
```
|
||||
@@ -409,21 +410,21 @@ flowchart TD
|
||||
|
||||
| 输入变量名 | 类型 | 必填 | 说明 |
|
||||
|------------|------|------|------|
|
||||
| `hxops_tool_api_base` | string | 否 | hxops 后端根地址,**无**尾斜杠,例 `http://host:8890` |
|
||||
| `HXOPS_TOOLS_API_BASE` | string | 否 | hxops 后端根地址,**无**尾斜杠,例 `http://host:8890` |
|
||||
| `hxops_tool_api_key` | string | 否 | 与 hxops `SHIPPING_NOTICE_TOOL_API_KEY` 一致 |
|
||||
|
||||
2. **hxops 自动注入**:用户经前端聊天调用 `货代发货通知 Agent` 时,`/api/chat/completions` 会把上述两项写入 Dify `inputs`(读 `SHIPPING_NOTICE_TOOL_API_BASE` / `SHIPPING_NOTICE_TOOL_API_KEY`)。**切换 dev / test / prod 只改 hxops 环境变量,Dify 画布 YAML 可原样导入**。
|
||||
2. **hxops 自动注入**:用户经前端聊天调用 `货代发货通知 Agent` 时,`/api/chat/completions` 会把上述两项写入 Dify `inputs`(读 `HXOPS_TOOLS_API_BASE` / `SHIPPING_NOTICE_TOOL_API_KEY`)。**切换 dev / test / prod 只改 hxops 环境变量,Dify 画布 YAML 可原样导入**。
|
||||
|
||||
3. **HTTP 节点统一模板**(所有 `HTTP_*` 节点 URL / Header 均按此填写,勿再写死 IP):
|
||||
|
||||
| 项 | 模板 |
|
||||
|----|------|
|
||||
| URL | `{{#hxops_tool_api_base#}}/api/shipping-notice/tools/<endpoint>`,例 `…/api/shipping-notice/tools/create_task` |
|
||||
| URL | `{{#HXOPS_TOOLS_API_BASE#}}/api/shipping-notice/tools/<endpoint>`,例 `…/api/shipping-notice/tools/create_task` |
|
||||
| Header `X-Shipping-Tool-Key` | `{{#hxops_tool_api_key#}}` |
|
||||
|
||||
> Dify 版本差异:若 UI 无法直接填 `{{#变量名#}}`,用变量选择器绑定 **输入变量** `hxops_tool_api_base` / `hxops_tool_api_key` 即可,语义相同。
|
||||
> Dify 版本差异:若 UI 无法直接填 `{{#变量名#}}`,用变量选择器绑定 **输入变量** `HXOPS_TOOLS_API_BASE` / `hxops_tool_api_key` 即可,语义相同。
|
||||
|
||||
**Agent 自定义工具(OpenAPI)**:导入地址 `{hxops_tool_api_base}/api/shipping-notice/tools/openapi.json`(或 Dify 环境变量拼 URL);换环境时重新「从 URL 导入」或改工具 Server URL 一次,**不必改 Chatflow 连线**。
|
||||
**Agent 自定义工具(OpenAPI)**:导入地址 `{HXOPS_TOOLS_API_BASE}/api/shipping-notice/tools/openapi.json`(或 Dify 环境变量拼 URL);换环境时重新「从 URL 导入」或改工具 Server URL 一次,**不必改 Chatflow 连线**。
|
||||
|
||||
**HTTP 公共配置**
|
||||
|
||||
@@ -432,7 +433,7 @@ flowchart TD
|
||||
| Method | POST |
|
||||
| Header | `X-Shipping-Tool-Key: {{#hxops_tool_api_key#}}` |
|
||||
| Header | `Content-Type: application/json`(JSON Body 节点) |
|
||||
| 基 URL | `{{#hxops_tool_api_base#}}/api/shipping-notice/tools/`(**禁止**写死 IP;旧示例 IP 仅作联调参考) |
|
||||
| 基 URL | `{{#HXOPS_TOOLS_API_BASE#}}/api/shipping-notice/tools/`(**禁止**写死 IP;旧示例 IP 仅作联调参考) |
|
||||
|
||||
**Dify Code 节点配置说明**
|
||||
|
||||
@@ -715,7 +716,7 @@ def main(
|
||||
| 项 | 值 |
|
||||
|----|-----|
|
||||
| Method | POST |
|
||||
| URL | `{{#hxops_tool_api_base#}}/api/shipping-notice/tools/create_task` |
|
||||
| URL | `{{#HXOPS_TOOLS_API_BASE#}}/api/shipping-notice/tools/create_task` |
|
||||
| Header | `X-Shipping-Tool-Key: {{#hxops_tool_api_key#}}`;`Content-Type: application/json` |
|
||||
| Body | `{{#拼装 create_task Body.create_body_json#}}`(JSON 对象,勿再加引号) |
|
||||
| 出参 | `body` · **String** |
|
||||
@@ -839,7 +840,7 @@ def main(text: str) -> dict:
|
||||
|
||||
| 项 | 值 |
|
||||
|----|-----|
|
||||
| URL | `{{#hxops_tool_api_base#}}/api/shipping-notice/tools/parse_notice` |
|
||||
| URL | `{{#HXOPS_TOOLS_API_BASE#}}/api/shipping-notice/tools/parse_notice` |
|
||||
| Header | `X-Shipping-Tool-Key`;`Content-Type: application/json` |
|
||||
| Body | 见下 |
|
||||
| 出参 | `body` · **String** |
|
||||
@@ -927,7 +928,7 @@ def main(body: str) -> dict:
|
||||
| 项 | 值 |
|
||||
|----|-----|
|
||||
| Method | POST |
|
||||
| URL | `{{#hxops_tool_api_base#}}/api/shipping-notice/tools/upload_inventory_file` |
|
||||
| URL | `{{#HXOPS_TOOLS_API_BASE#}}/api/shipping-notice/tools/upload_inventory_file` |
|
||||
| Header | `X-Shipping-Tool-Key: {{#hxops_tool_api_key#}}` |
|
||||
| Body 类型 | **form-data** |
|
||||
| form `task_id` | `{{#conversation.task_id#}}` · String |
|
||||
@@ -3024,3 +3025,4 @@ GET /api/shipping-notice/tools/checkpoint-catalog
|
||||
| `backend/tests/test_shipping_notice_tools.py` | Tool 集成测试 |
|
||||
| `backend/tests/test_shipping_notice_state_machine.py` | registry / task UI 快照 |
|
||||
| `scripts/rpa/freight_rpa_worker.py` | RPA Worker |
|
||||
|
||||
Reference in new issue
Block a user