diff --git a/ai2/api_inf.md b/ai2/api_inf.md deleted file mode 100644 index 0c6345c..0000000 --- a/ai2/api_inf.md +++ /dev/null @@ -1,93 +0,0 @@ -# AI 推理 API 接口说明 - -🔹 1. 启动检测任务 `/ai/stream/detect` - -* **方法**:`POST` -* **是否需要 Body**:✅ 是 - -#### 请求参数(JSON Body) - -```json -{ - "user_id": "user_12345", - "source_url": "rtsp://192.168.10.5/live/stream1", - "push_url": "rtmp://192.168.10.5/live/output1", - "model_path": "best.pt", - "detect_classes": ["person", "car", "bicycle"], - "confidence": 0.6 -} -``` - -| 字段名 | 类型 | 是否必填 | 说明 | -| ---------------- | --------- | ---- | ------------------------------------| -| `user_id` | string | ✅ 是 | 用户 ID,必须存在于数据库表 `users` | -| `source_url` | string | ✅ 是 | 输入视频流地址(RTSP、本地等) | -| `push_url` | string | ✅ 是 | 输出推流地址(RTMP) | -| `model_path` | string | ✅ 是 | 检测模型路径(`.pt` 文件) | -| `detect_classes` | string\[] | ✅ 是 | 检测目标类别列表 | -| `confidence` | float | ❌ 否 | 检测置信度阈值,默认值为 `0.5` | - -#### 成功响应 - -```json -{ - "success": true, - "message": "任务已启动", - "task_id": "dc391d1f-2de3-4973-9025-8975cb3e3425" -} -``` - -#### 错误响应 - -```json -{ - "success": false, - "message": "用户无权限,禁止启动任务" -} - -🔹 2. 停止指定任务 `/ai/stream/` - -* **方法**:`POST` -* **是否需要 Body**:❌ 否 -* **描述**:根据任务 ID 停止正在运行的检测任务。 - ---- - -🔹 3. 重启指定任务 `/ai/stream/restart/` - -* **方法**:`POST` -* **是否需要 Body**:❌ 否 -* **描述**:重启指定任务。 - ---- - -🔹 4. 查询任务状态 `/ai/stream/` - -* **方法**:`GET` -* **是否需要 Body**:❌ 否 -* **描述**:查看指定任务的运行状态。 - ---- - -🔹 5. 获取所有任务 `/ai/stream/tasks` - -* **方法**:`GET` -* **是否需要 Body**:❌ 否 -* **描述**:返回当前所有正在运行的任务信息。 - ---- - -🔹 6. 停止所有任务 `/ai/stream/stopTasks` - -* **方法**:`POST` -* **是否需要 Body**:❌ 否 -* **描述**:停止所有正在运行的检测任务。 - ---- - -🔹 7. 重置服务 `/ai/reset` - -* **方法**:`POST` -* **是否需要 Body**:❌ 否 -* **描述**:清除全部状态,重置模型、任务、资源状态。 -