Add binding for local temp directory in YAML#6191
Add binding for local temp directory in YAML#6191Soulter merged 2 commits intoAstrBotDevs:masterfrom
Conversation
Bind the local temp directory to the sandbox for file access.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Docker Compose configuration by introducing a new volume binding. This change ensures that the local temporary directory is accessible within the sandbox, which is crucial for handling uploaded files and enabling their access within the application's environment. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="compose-with-shipyard.yml" line_range="40" />
<code_context>
- DEFAULT_SHIP_MEMORY=512m
volumes:
- ${PWD}/data/shipyard/bay_data:/app/data
+ - ${PWD}/data/temp:/AstrBot/data/temp # Bind the local temp directory to the sandbox so that the uploaded file can be access in the sandbox
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
</code_context>
<issue_to_address>
**nitpick (typo):** Correct minor grammar in the inline comment for clarity.
The inline comment currently says `can be access in the sandbox`; please change this to `can be accessed in the sandbox` for correct grammar and clearer documentation of this volume mount.
```suggestion
- ${PWD}/data/temp:/AstrBot/data/temp # Bind the local temp directory to the sandbox so that the uploaded file can be accessed in the sandbox
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Code Review
This pull request adds a volume mount to the compose-with-shipyard.yml file to share a temporary directory with the sandbox container, enabling file access between the main application and the sandbox. The change is logical and serves its purpose. My feedback includes a minor correction to a comment for improved clarity.
compose-with-shipyard.yml
Outdated
| - DEFAULT_SHIP_MEMORY=512m | ||
| volumes: | ||
| - ${PWD}/data/shipyard/bay_data:/app/data | ||
| - ${PWD}/data/temp:/AstrBot/data/temp # Bind the local temp directory to the sandbox so that the uploaded file can be access in the sandbox |
There was a problem hiding this comment.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
|
Documentation Updates 1 document(s) were updated by changes in this PR: pr4697的改动View Changes@@ -217,6 +217,24 @@
权限控制行为:
- 非管理员用户尝试使用这些工具时,会收到权限拒绝错误,并提示联系管理员或使用 `/sid` 命令查看自己的用户 ID
- 该修复确保所有 Computer Use 操作(Shell、Python、文件传输)受到统一的权限管理,防止非管理员用户在 Computer Use 工具可用时执行任何 sandbox 或本地环境操作
+
+**Docker Compose 配置优化(PR #6191)**
+
+[PR #6191](https://github.com/AstrBotDevs/AstrBot/pull/6191) 优化了 Docker Compose 配置,新增了本地 temp 目录到沙箱的卷绑定,解决了上传文件在沙箱中无法访问的问题([Issue #5158](https://github.com/AstrBotDevs/AstrBot/issues/5158))。
+
+在 `compose-with-shipyard.yml` 配置中,Shipyard 服务新增了以下卷绑定:
+
+```yaml
+volumes:
+ - ${PWD}/data/temp:/AstrBot/data/temp
+```
+
+该绑定将本地 AstrBot 的 `data/temp` 目录映射到沙箱内的 `/AstrBot/data/temp` 路径,确保:
+- 用户通过 `FILE_UPLOAD_TOOL` 上传到本地 temp 目录的文件可以在沙箱环境中访问
+- 沙箱执行的代码可以读取本地上传的文件,支持文件处理、数据分析等场景
+- 工具图片缓存(`data/temp/tool_images/`)在沙箱中可见,便于多模态任务处理
+
+该配置确保了本地和沙箱环境之间的文件共享机制正常工作,提升了文件传输工具的可用性。
##### 流式响应配置(PR #5348)
|
Bind the local temp directory to the sandbox for file access.
参考 #5158
Modifications / 改动点
仅更改 https://github.com/AstrBotDevs/AstrBot/blob/master/compose-with-shipyard.yml 将
${PWD}/data/temp绑定到沙箱中的/AstrBot/data/temp目录下。Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
requirements.txt和pyproject.toml文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations inrequirements.txtandpyproject.toml.Summary by Sourcery
Build: