|
| 1 | +# Local File Upload Guide Rule |
| 2 | + |
| 3 | +When the user mentions a file on their local machine and you need to read it, guide them to upload the file to the workspace first. |
| 4 | + |
| 5 | +## Guidelines |
| 6 | + |
| 7 | +If you encounter a situation where: |
| 8 | +- The user references a file path that appears to be on their local machine (not in the current workspace) |
| 9 | +- You need to access or read this file to complete the user's request |
| 10 | +- The file does not exist in the current workspace |
| 11 | + |
| 12 | +Then you should guide the user to upload the file by following these steps: |
| 13 | + |
| 14 | +1. **Explain the situation**: Let the user know that you cannot access files on their local machine directly |
| 15 | +2. **Provide upload instructions**: Guide them with the following steps: |
| 16 | + - 在界面左侧找到「项目文件」面板 |
| 17 | + - 点击面板右上角的下拉菜单 |
| 18 | + - 选择「上传文件」选项 |
| 19 | + - 上传需要的文件到工作空间 |
| 20 | + |
| 21 | +3. **Wait for confirmation**: After the user uploads the file, confirm the file path in the workspace before proceeding |
| 22 | + |
| 23 | +## Example Scenarios |
| 24 | + |
| 25 | +### Scenario 1: User mentions a local file path |
| 26 | +``` |
| 27 | +User: "请帮我分析一下 ~/Documents/report.pdf 这个文件" |
| 28 | +Assistant: "我无法直接访问您本地机器上的文件。请您通过以下步骤将文件上传到工作空间: |
| 29 | +1. 在界面左侧找到「项目文件」面板 |
| 30 | +2. 点击面板右上角的下拉菜单 |
| 31 | +3. 选择「上传文件」选项 |
| 32 | +4. 上传 report.pdf 文件 |
| 33 | +
|
| 34 | +上传完成后,请告诉我文件在工作空间中的路径,我就可以帮您分析了。" |
| 35 | +``` |
| 36 | + |
| 37 | +### Scenario 2: User asks to read a non-existent file |
| 38 | +``` |
| 39 | +User: "读取 /Users/john/data.csv 并分析数据" |
| 40 | +Assistant: "该文件路径似乎指向您的本地机器。我需要您先将文件上传到工作空间: |
| 41 | +1. 在界面左侧的「项目文件」面板右上角 |
| 42 | +2. 点击下拉菜单,选择「上传文件」 |
| 43 | +3. 上传 data.csv 文件 |
| 44 | +
|
| 45 | +上传后我就可以读取并分析数据了。" |
| 46 | +``` |
| 47 | + |
| 48 | +## Exceptions |
| 49 | + |
| 50 | +- If the file path is within the current workspace directory, proceed to read it directly |
| 51 | +- If the user has already uploaded the file and provided a workspace path, use that path |
| 52 | +- For files that are clearly system files or configuration files (e.g., `/etc/hosts`), explain that those cannot be accessed for security reasons |
| 53 | + |
| 54 | +## Rationale |
| 55 | + |
| 56 | +- The AI agent runs in a sandboxed workspace and cannot access files on the user's local machine |
| 57 | +- Guiding users to upload files ensures they can complete their tasks successfully |
| 58 | +- Clear instructions improve user experience and reduce confusion |
0 commit comments