feat: 新增 teams 目录
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
96
teams/api/upload-api.md
Normal file
96
teams/api/upload-api.md
Normal file
@@ -0,0 +1,96 @@
|
||||
# 文件上传 API
|
||||
|
||||
## 基础信息
|
||||
|
||||
| 项目 | 说明 |
|
||||
|------|------|
|
||||
| 基础URL | `http://localhost:8082` |
|
||||
| 上传模式 | local / minio(配置决定) |
|
||||
|
||||
## 配置说明
|
||||
|
||||
```yaml
|
||||
# config.yaml
|
||||
upload_mode: "local" # 上传模式:local 或 minio
|
||||
upload_local_path: "resource/files" # 本地存储路径
|
||||
server_base_url: "http://localhost:8082" # 服务器基础URL
|
||||
|
||||
# MinIO 配置(upload_mode 为 minio 时需要)
|
||||
minio_endpoint: "localhost:9000"
|
||||
minio_access_key: "your-access-key"
|
||||
minio_secret_key: "your-secret-key"
|
||||
minio_bucket: "x-agents"
|
||||
minio_use_ssl: false
|
||||
```
|
||||
|
||||
## 接口列表
|
||||
|
||||
### 1. 上传文件
|
||||
|
||||
**请求**
|
||||
|
||||
```
|
||||
POST /api/file_upload
|
||||
Content-Type: multipart/form-data
|
||||
```
|
||||
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| file | File | 是 | 要上传的文件 |
|
||||
|
||||
**响应**
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"url": "http://localhost:8082/files/abc123.pdf",
|
||||
"fileKey": "abc123",
|
||||
"message": "Upload successful"
|
||||
}
|
||||
```
|
||||
|
||||
**错误响应**
|
||||
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"message": "File too large (max 100MB)"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 2. 删除文件
|
||||
|
||||
**请求**
|
||||
|
||||
```
|
||||
DELETE /api/file_upload/:filename
|
||||
```
|
||||
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| filename | String | 是 | 文件名(不含路径) |
|
||||
|
||||
**响应**
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "File deleted"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 3. 访问文件(仅本地模式)
|
||||
|
||||
文件上传后,本地模式下可通过以下 URL 直接访问:
|
||||
|
||||
```
|
||||
GET /files/{filename}
|
||||
```
|
||||
|
||||
例如:`http://localhost:8082/files/abc123.pdf`
|
||||
|
||||
> 注意:MinIO 模式返回的是预签名 URL,有效期 24 小时。
|
||||
Reference in New Issue
Block a user