1、搭建本地dify平台
克隆 Dify 代码仓库
git clone https://github.com/langgenius/dify.git
cd dify/docker
cp .env.example .env
修改一些隐私配置.env
1、运行openssl rand -base64 42
,更新默认SECRET_KEY
。
# A secretkey that is used for securely signing the session cookie
# and encrypting sensitive information on the database.
# You can generate a strong key using `openssl rand -base64 42`.
SECRET_KEY=sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
2、 修改替换数据库密码DB_PASSWORD
,sed -i 's/difyai123456/newpasswd/g' .env
# ------------------------------
# Database Configuration
# The database uses PostgreSQL. Please use the public schema.
# It is consistent with the configuration in the 'db' service below.
# ------------------------------
DB_USERNAME=postgres
DB_PASSWORD=difyai123456
DB_HOST=db
DB_PORT=5432
DB_DATABASE=dify
3、假若本地端口80和443已经被占用了,需要修改下端口
ports:
- "8089:80"
- "441:443"
4、ETL_TYPE修改为Unstructured,原因是
注册账号,获取API-keys Unstructured Dashboard
# ETl type, support: `dify`, `Unstructured`
# `dify` Dify's proprietary file extraction scheme
# `Unstructured` Unstructured.io file extraction scheme
ETL_TYPE=Unstructured
# Unstructured API path, needs to be configured when ETL_TYPE is Unstructured.
# For example: http://unstructured:8000/general/v0/general
UNSTRUCTURED_API_URL=https://api.unstructuredapp.io/general/v0/general
UNSTRUCTURED_API_KEY=
最后运行
docker compose up -d
需要docker V2版本,当时踩坑,重装了docker。
在浏览器中输入 http://localhost
就可访问 Dify。
2、配置Embedding模型+混合检索 (jina)
1、为啥是jina,目前免费。
2、也测试了豆包的Doubao-embedding,对我要测试的文本结构支持不太好,当时还发帖求助了。 求佬指教:各种结构树形式的PDF可以推荐用什么模型做知识库 - 常规话题 / 人工智能 - LINUX DO
1、设置中模型供应商选择Jina
2、访问网址Jina
不需要注册,直接拿到token来用。
""
可以超一点token,可以换IP申请
3、填上token,不需要代理,国内可访问
3、one-api接口模型配置
使用的接口原帖:
【GPT+Claude+LLaMA+Mistral+DeepSeek+Kimi+通义千问+智谱清言+跃问】免费API分享 - 常规话题 / 人工智能 - LINUX DO 感谢分享
推荐使用后面的aff邀请,各额外+5额度奥 —> https://api.mihoyo.bf/register?aff=NsB4。
1、设置令牌,复制token
2、选择openAI,填上API key和 代理网址,保存即可
4、设置默认模型
点击设置系统默认模型
图片出处 Intended Usage & Model Info
5、搭建知识库
这里就比较简单了,贴个界面图
6、对话机器人
上下文这里关联刚刚做好的知识库,就可以进行对话了。