From f5d580bbf046c82472efe1d6b65d1527f60d2c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AC=E6=98=8E?= <83812544+Ed1s0nZ@users.noreply.github.com> Date: Thu, 23 Jul 2026 20:17:17 +0800 Subject: [PATCH] Add files via upload --- docs/en-US/api-reference.md | 19 +++++++++++++++++++ docs/zh-CN/api-reference.md | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/docs/en-US/api-reference.md b/docs/en-US/api-reference.md index d61a1ba4..c1ad1884 100644 --- a/docs/en-US/api-reference.md +++ b/docs/en-US/api-reference.md @@ -67,6 +67,25 @@ Streaming endpoints are long-lived. Clients should: - disable proxy buffering; - pass `conversationId` when continuing a conversation. +## File Management Sources + +The file management page and `GET /api/chat-uploads` group conversation-related files by source. Directory names still use project IDs or conversation IDs for stability, while the UI prefers project names or conversation titles and keeps the full ID available in tooltips or copied paths. + +| Source | `source` | Typical directory | Meaning | Mutability | +| --- | --- | --- | --- | --- | +| Workspace files | `workspace` | `tmp/workspace/projects//...`, `tmp/workspace/conversations//...` | The Agent workspace for downloaded files, analysis scripts, intermediate results, and generated CSV/XLSX/Markdown files. If an AI-generated file is missing from the UI, check this source first. | Read-only listing; supports copy path, download, and export. | +| Conversation artifacts | `conversation_artifact` | `data/conversation_artifacts//...` | Conversation-scoped deliverables or archived artifacts such as summaries, reports, or middleware-generated artifacts. | Read-only listing; supports copy path, download, and export. | +| Tool outputs | `reduction` | `tmp/reduction/projects//...`, `tmp/reduction/conversations//...` | Persisted full tool outputs, scan raw data, or outputs saved before truncation. Useful for reviewing long command or scan results. | Read-only listing; supports copy path, download, and export. | +| Chat uploads | `upload` | `chat_uploads///...` | Files manually uploaded in chat or from the file management page. Copy the server absolute path into chat when the AI should reference a file. | Supports upload, mkdir, text edit, rename, delete, copy path, download, and export. | + +Related endpoints: + +- `GET /api/chat-uploads`: list files filtered by source, project, conversation, or filename. +- `GET /api/chat-uploads/path`: resolve a file-management relative path or internal virtual path to a server absolute path for copy actions. +- `GET /api/chat-uploads/download`: download a file. +- `GET /api/chat-uploads/export`: export the current filtered result as a ZIP. +- `POST /api/chat-uploads`: upload into the chat uploads directory. + ## Asset Management and Bulk Import Asset endpoints: diff --git a/docs/zh-CN/api-reference.md b/docs/zh-CN/api-reference.md index be3e844c..feb494c7 100644 --- a/docs/zh-CN/api-reference.md +++ b/docs/zh-CN/api-reference.md @@ -74,6 +74,25 @@ Content-Type: application/json - `POST /api/conversations/:id/delete-turn` - `GET /api/messages/:id/process-details` +## 文件管理来源 + +文件管理页面和 `/api/chat-uploads` 列表接口会把对话相关文件按来源归类。底层目录仍使用项目 ID 或会话 ID 保持稳定,界面会优先显示项目名或对话标题,完整 ID 可在提示或路径中查看。 + +| 来源 | `source` | 典型目录 | 说明 | 可变更性 | +| --- | --- | --- | --- | --- | +| 工作目录 | `workspace` | `tmp/workspace/projects//...`、`tmp/workspace/conversations//...` | Agent 执行任务时保存下载文件、分析脚本、中间结果和生成的 CSV/XLSX/Markdown 等。用户反馈“AI 生成的文件找不到”时,通常先看这里。 | 只读展示;支持复制路径、下载、导出。 | +| 会话产物 | `conversation_artifact` | `data/conversation_artifacts//...` | 系统按会话归档的交付物或会话级产物,例如总结、报告、模型中间件生成的归档内容。 | 只读展示;支持复制路径、下载、导出。 | +| 工具输出 | `reduction` | `tmp/reduction/projects//...`、`tmp/reduction/conversations//...` | 超长工具输出、扫描原文或被截断前落盘的结果缓存。适合回看完整工具输出。 | 只读展示;支持复制路径、下载、导出。 | +| 对话附件 | `upload` | `chat_uploads///...` | 用户在对话或文件管理页手动上传的附件。需要让 AI 引用某文件时,可复制服务器绝对路径粘贴到对话中。 | 可上传、新建目录、编辑文本文件、重命名、删除、复制路径、下载、导出。 | + +相关接口: + +- `GET /api/chat-uploads`:按来源、项目、会话、文件名筛选文件。 +- `GET /api/chat-uploads/path`:把文件管理中的相对路径或内部虚拟路径解析为服务器绝对路径,用于复制文件或目录路径。 +- `GET /api/chat-uploads/download`:下载指定文件。 +- `GET /api/chat-uploads/export`:导出当前筛选结果为 ZIP。 +- `POST /api/chat-uploads`:上传到对话附件目录。 + ## 项目、漏洞、攻击链 项目: