开源的 LLM 应用开发平台-Dify 部署和使用
加粗样式
Dify
简介
官网 http://difyai.com/
生成式 AI 应用创新引擎
开源的 LLM 应用开发平台
Dify 为开发者提供了健全的应用模版和编排框架,你可以基于它们快速构建大型语言模型驱动的生成式 AI 应用,将创意变为现实,也可以随时按需无缝扩展,驱动业务增长
欢迎使用 Dify
Dify 是一款开源的大语言模型(LLM) 应用开发平台。它融合了后端即服务(Backend as Service)和 LLMOps 的理念,使开发者可以快速搭建生产级的生成式 AI 应用。即使你是非技术人员,也能参与到 AI 应用的定义和数据运营过程中。
由于 Dify 内置了构建 LLM 应用所需的关键技术栈,包括对数百个模型的支持、直观的 Prompt 编排界面、高质量的 RAG 引擎、稳健的 Agent 框架、灵活的流程编排,并同时提供了一套易用的界面和 API。这为开发者节省了许多重复造轮子的时间,使其可以专注在创新和业务需求上。
Dify 能做什么?
创业,快速的将你的 AI 应用创意变成现实,无论成功和失败都需要加速。在真实世界,已经有几十个团队通过 Dify 构建 MVP(最小可用产品)获得投资,或通过 POC(概念验证)赢得了客户的订单。
将 LLM 集成至已有业务,通过引入 LLM 增强现有应用的能力,接入 Dify 的 RESTful API 从而实现 Prompt 与业务代码的解耦,在 Dify 的管理界面是跟踪数据、成本和用量,持续改进应用效果。
作为企业级 LLM 基础设施,一些银行和大型互联网公司正在将 Dify 部署为企业内的 LLM 网关,加速 GenAI 技术在企业内的推广,并实现中心化的监管。
探索 LLM 的能力边界,即使你是一个技术爱好者,通过 Dify 也可以轻松的实践 Prompt 工程和 Agent 技术,在 GPTs 推出以前就已经有超过 60,000 开发者在 Dify 上创建了自己的第一个应用。
官方场景样例:
私有化部署
特性与技术规格
详情参考:https://docs.dify.ai/zh-hans/getting-started/readme/features-and-specifications
功能
Dify 是一个开源LLM的应用程序开发平台。其直观的界面结合了代理 AI 工作流、RAG 管道、代理功能、模型管理、可观察性功能等,让您可以快速从原型到生产。
社区版
GitHub : https://github.com/langgenius/dify
Lisence
此存储库在 Dify 开源许可证
下提供,该许可证本质上是 Apache 2.0
,但有一些额外的限制。
# Open Source License
Dify is licensed under the Apache License 2.0, with the following additional conditions:
1. Dify may be utilized commercially, including as a backend service for other applications or as an application development platform for enterprises. Should the conditions below be met, a commercial license must be obtained from the producer:
a. Multi-tenant service: Unless explicitly authorized by Dify in writing, you may not use the Dify source code to operate a multi-tenant environment.
- Tenant Definition: Within the context of Dify, one tenant corresponds to one workspace. The workspace provides a separated area for each tenant's data and configurations.
b. LOGO and copyright information: In the process of using Dify's frontend, you may not remove or modify the LOGO or copyright information in the Dify console or applications. This restriction is inapplicable to uses of Dify that do not involve its frontend.
- Frontend Definition: For the purposes of this license, the "frontend" of Dify includes all components located in the `web/` directory when running Dify from the raw source code, or the "web" image when running Dify with Docker.
Please contact business@dify.ai by email to inquire about licensing matters.
2. As a contributor, you should agree that:
a. The producer can adjust the open-source agreement to be more strict or relaxed as deemed necessary.
b. Your contributed code may be used for commercial purposes, including but not limited to its cloud business operations.
Apart from the specific conditions mentioned above, all other rights and restrictions follow the Apache License 2.0. Detailed information about the Apache License 2.0 can be found at http://www.apache.org/licenses/LICENSE-2.0.
The interactive design of this product is protected by appearance patent.
© 2024 LangGenius, Inc.
----------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
翻译解读:DeepSeek官网解读
以下是对Dify开源许可协议的翻译及关键风险分析,并附合规使用建议:
一、协议核心条款翻译(非官方法律文本)
基本授权
依据Apache 2.0协议开放源代码,允许商业使用
特殊限制条款
-
多租户服务限制 个人理解:【单一运营使用,不能作为Saas服务提供多租户支持】
- ❗ 禁止未经书面授权使用源代码运营多租户环境
- 租户定义:每个Dify工作区视为独立租户
-
品牌标识要求
- ❗ 使用原始前端代码时(
web/
目录或Docker的web镜像)必须保留Dify LOGO和版权信息
- 仅使用后端服务可豁免此要求 个人理解:【可以基于这个做自己的前端展示】
- ❗ 使用原始前端代码时(
贡献者条款
- 开发者保留调整开源协议的权利
- 贡献代码可能被用于商业用途(包括云服务运营)
专利声明
产品交互设计受外观专利保护
二、关键风险点与违法红线
⚠️ 高风险行为
-
多租户SaaS服务
- 若基于Dify源代码开发类似Dify Cloud的云服务
- 典型场景:为多个客户提供独立工作区的SaaS平台
-
界面篡改风险
- 修改前端界面中的Dify LOGO或版权声明
- 风险场景:客户定制化开发时未保留原始标识
-
专利侵权风险
- 直接复制产品交互设计可能触发外观专利侵权
⚠️ 次级风险
-
开源协议变更
- 开发者后续可能收紧协议条款(如增加付费功能)
-
代码使用不可逆
- 贡献的代码可能永久被用于Dify的商业云服务
三、合规使用建议
✅ 安全使用场景
-
企业内部工具开发
- 开发仅供本企业使用的AI应用(单租户模式)
- 示例:构建内部知识库系统/智能客服平台
-
商业产品后端
- 使用Dify作为后台服务,自主开发新前端界面
- 注意:需通过API集成,避免直接修改原始前端代码
-
定制化解决方案
- 为客户部署独立Dify实例(每个客户单独服务器)
⚠️ 需授权场景
使用场景 | 合规路径 |
---|---|
多企业SaaS平台开发 | 联系 business@dify.ai 获取商业授权 |
修改原始界面LOGO | 购买企业版或协商特别授权 |
交互设计复用 | 进行专利规避设计或获得许可 |
🔧 技术规避方案
补充建议:
- 正式商用前建议进行法律合规审查
- 保留所有协议沟通书面记录
- 监控Dify官方协议更新动态(建议订阅GitHub仓库)
- 贡献代码前签署CLA(Contributor License Agreement)
部署【社区版】
最小硬件环境
在安装 Dify 之前,请确保您的计算机满足以下最低系统要求:
CPU >= 2 Core CPU >= 2 核
RAM >= 4 GiB 内存 >= 4 GiB
部署环境
Alibaba Cloud Linux 3.2104 LTS 64位
硬件:CPU: 4 RAM: 8G
软件:
- Docker version 26.1.3, build b72abbb
- Docker Compose version v2.27.0
- Git
Git下载 Dify github仓库
mkdir /home/dify
cd /home/dify
git clone https://github.com/langgenius/dify.git
# zip 下载,浏览器copy一下链接
wget xxxxx
如果git clone 下载不下来,就下载zip压缩包,导入到系统
Docker Compose 安装
参考官方:https://docs.dify.ai/zh-hans/getting-started/install-self-hosted/docker-compose
cd dify
cd docker
cp .env.example .env
docker compose up -d
运行后,您可以在浏览器中访问 Dify 仪表板 http://localhost/install
并启动初始化过程。
访问:http:ip
创建账号,登录系统
快速使用
官方手册: https://docs.dify.ai/zh-hans/guides/model-configuration
设置简体中文
模型供应商-设置 【可设置多家供应商】
根据自己部署的服务器 推理平台,配置自己的api接口调用。Ollama,xinterence…
使用 硅基流动 免费的 大模型 DeepSeek R1 8B
如果有自己的部署
使用 硅基流动 免费的 文本嵌入模型 BAAI/bge-large-zh-v1.5 中文词嵌入模型
根据模板创建小机器人【翻译,聊天等】
阿里云按量计费服务器
http://47.113.193.234/chat/AKd1LUV8rSPFfOgW
创建应用,根据模板
编排应用能力
发布应用
提供应用的开发API,可接入该应用功能到自己系统中【自己开发前端或服务内部业务使用】
知识库【文件解析】
就是 文档解析-》生成嵌入向量-》重排序》构建检索知识库
导入外部知识库
配置外部知识库接口
业务提供方,企业内部知识库接口:根据下面文档的接口,开发自己的外部知识库接口,接入到dify上
https://docs.dify.ai/guides/knowledge-base/external-knowledge-api-documentation
结束