1、上传文件code模块读取
参考:
https://github.com/svcvit/dify-sandbox-py/blob/main/README_CN.md
dify运行的沙盒sandbox docker,由于与其他docker隔离,所以文件不互通
在官方 docker-compose.yaml 中,找到 sandbox 的 image 部分内容,替换镜像即可。
修改docker-compose.yaml ,修改完docker compose up
sandbox:
# image: langgenius/dify-sandbox:0.2.10
image: svcvit/dify-sandbox-py:0.1.3
volumes:
- ./volumes/app/storage/upload_files:/upload_files
2、沙盒包安装
将需要的依赖放入/docker/volumes/sandbox/dependencies/python-requirements.txt,重启sandbox即可
requirements.txt文件中指定源:-i https://pypi.tuna.tsinghua.edu.cn/simple