文件
列出文件
GET /external/v1/projects/{project_id}/files| 参数 | 说明 |
|---|---|
path | 目录路径,默认 / |
ws | 工作区 UUID(可选) |
bash
curl "http://localhost:8000/external/v1/projects/PROJECT_ID/files?path=/reports" \
-H "Authorization: Bearer API_KEY"读取文件内容
GET /external/v1/projects/{project_id}/files/content| 参数 | 说明 |
|---|---|
path | 文件路径 |
ws | 工作区 UUID(可选) |
bash
curl "http://localhost:8000/external/v1/projects/PROJECT_ID/files/content?path=/reports/summary.md" \
-H "Authorization: Bearer API_KEY"写入文件
PUT /external/v1/projects/{project_id}/files/content请求体(JSON):
| 字段 | 类型 | 说明 |
|---|---|---|
path | string | 文件路径(不存在则创建) |
content | string | 文件内容(文本) |
ws | string(可选) | 工作区 UUID |
bash
curl -X PUT http://localhost:8000/external/v1/projects/PROJECT_ID/files/content \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{"path": "/output/result.md", "content": "# 结果\n..."}'上传文件
POST /external/v1/projects/{project_id}/files/uploadMultipart form-data。上传到知识库工作区的非 Markdown 文件会自动转换为 .md(支持 .docx、.pdf、.xlsx、.pptx 等 14 种格式)。
bash
curl -X POST http://localhost:8000/external/v1/projects/PROJECT_ID/files/upload \
-H "Authorization: Bearer API_KEY" \
-F "file=@report.pdf" \
-F "dir_path=/documents" \
-F "ws=WORKSPACE_UUID"删除文件
DELETE /external/v1/projects/{project_id}/files| 参数 | 说明 |
|---|---|
path | 文件或目录路径 |
ws | 工作区 UUID(可选) |
bash
curl -X DELETE "http://localhost:8000/external/v1/projects/PROJECT_ID/files?path=/tmp/old.md" \
-H "Authorization: Bearer API_KEY"