Dify多租户工作区-Dify版本1.4.0

573 阅读1分钟

涉及修改文件

web模块:

web/app/install/installForm.tsx

api模块:

api/controllers/console/setup.py

api/services/account_service.py

api/controllers/console/error.py

打包镜像:

(Dockerfile 找到if you located in China 放开注释)

docker build -t langgenius/dify-web:1.4.0 .

docker build -t langgenius/dify-api:1.4.0 .

1.去除注册重定向至登录

web/app/install/installForm.tsx 在这里插入图片描述

2.注释注册校验、租户校验

api/controllers/console/setup.py 在这里插入图片描述

3.修改创建账号逻辑

api/services/account_service.py 在这里插入图片描述

多租户完成

至此dify已经可以使用多租户了。

1.png

2.png

但是http://127.0.0.1/install 链接访问即可注册。所以我们下面增加一个邀请码验证

4.增加邀请码

web/app/install/installForm.tsx

找到accountFormSchema,增加invitationCode

找到InstallForm,增加invitationCode默认值 在这里插入图片描述 在这里插入图片描述 增加邀请码输入框: 在这里插入图片描述 api后端校验:api/controllers/console/setup.py 在这里插入图片描述 api/controllers/console/error.py 增加异常信息 在这里插入图片描述

邀请码注册完成

邀请码注册 邀请码需要我们手动存入redis,或者增加接口、页面灵活添加都可以

在这里插入图片描述 在这里插入图片描述