当前位置:   article > 正文

Dify快速接入微信

Dify快速接入微信

一、Dify简介

项目官网Dify.AI · 生成式 AI 应用创新引擎

Dify 是一款开源的大语言模型(LLM) 应用开发平台。它融合了后端即服务(Backend as Service)和 LLMOps 的理念,使开发者可以快速搭建生产级的生成式 AI 应用。即使你是非技术人员,也能参与到 AI 应用的定义和数据运营过程中。

由于 Dify 内置了构建 LLM 应用所需的关键技术栈,包括对数百个模型的支持、直观的 Prompt 编排界面、高质量的 RAG 引擎以及灵活的 Agent 框架,并同时提供了一套易用的界面和 API。这为开发者节省了许多重复造轮子的时间,使其可以专注在创新和业务需求上。

为什么使用 Dify?

你或许可以把 LangChain 这类的开发库(Library)想象为有着锤子、钉子的工具箱。与之相比,Dify 提供了更接近生产需要的完整方案,Dify 好比是一套脚手架,并且经过了精良的工程设计和软件测试。

重要的是,Dify 是开源的,它由一个专业的全职团队和社区共同打造。你可以基于任何模型自部署类似 Assistants API 和 GPTs 的能力,在灵活的安全的基础上,同时保持对数据的完全控制。

我们的社区用户对 Dify 的产品评价可以归结为简单、克制、迭代迅速。 ——路宇,Dify.AI CEO

希望以上信息和这份指南可以帮助你了解这款产品,我们相信 Dify 是为你而做的(Do It For You)。

Dify 能做什么?

Dify 一词源自 Define + Modify,意指定义并且持续的改进你的 AI 应用,它是为你而做的(Do it for you)。

  • 创业,快速的将你的 AI 应用创意变成现实,无论成功和失败都需要加速。在真实世界,已经有几十个团队通过 Dify 构建 MVP(最小可用产品)获得投资,或通过 POC(概念验证)赢得了客户的订单。
  • 将 LLM 集成至已有业务,通过引入 LLM 增强现有应用的能力,接入 Dify 的 RESTful API 从而实现 Prompt 与业务代码的解耦,在 Dify 的管理界面是跟踪数据、成本和用量,持续改进应用效果。
  • 作为企业级 LLM 基础设施,一些银行和大型互联网公司正在将 Dify 部署为企业内的 LLM 网关,加速 GenAI 技术在企业内的推广,并实现中心化的监管。
  • 探索 LLM 的能力边界,即使你是一个技术爱好者,通过 Dify 也可以轻松的实践 Prompt 工程和 Agent 技术,在 GPTs 推出以前就已经有超过 60,000 开发者在 Dify 上创建了自己的第一个应用。

image-9jkv.png

二、Dify on WeChat

项目地址https://github.com/hanfangyuan4396/dify-on-wechat.git

项目为 chatgpt-on-wechat下游分支

额外对接了LLMOps平台 Dify,支持Dify智能助手模型,调用工具和知识库,支持Dify工作流。

如果作者的项目对您有帮助请帮助作者点一个star吧~

image-95t6.png

三、部署

前期准备

首先需要一台服务器,推荐浪浪云服务器:高防,稳定,有保障!!!

浪浪云限时活动推荐:

Dify的搭建:

1.可以参考官方的教程:

2.如果不想这么麻烦的话可以使用浪浪云的一键部署Dify知识库可接入全场大模型【一.搭建演示篇】 | 浪浪云技术栈 (langlangy.com)

image-fe3n.png

升级Dify版本

购买完浪浪云的服务器后可能会出现Dify的版本较低,此时我们升级版本即可

1.远程连接浪浪云服务器Linux服务器登陆教程 - 浪浪云:提供高性能、可靠稳定的云服务器解决方案 (langlangy.com)

2.挨个执行命令

  1. # 进入对应的目录
  2. cd #返回根目录
  3. cd dify/docker/ #进入对应的文件夹
  4. vi docker-compose.yaml #编辑对应的文件信息,或者删除文件,新建也可
  5. docker compose down #停止容器
  6. docker compose pull #拉取新的镜像
  7. docker compose up -d #启动容器

docker-compose.yaml文件内容,可能存在一定的时效性,目前2024年5月8日13:59:54[处于最新版],也可到项目的官网进行复制对应的文件

  1. version: '3'
  2. services:
  3. # API service
  4. api:
  5. image: langgenius/dify-api:0.6.6
  6. restart: always
  7. environment:
  8. # Startup mode, 'api' starts the API server.
  9. MODE: api
  10. # The log level for the application. Supported values are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
  11. LOG_LEVEL: INFO
  12. # A secret key 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`.
  13. SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
  14. # The base URL of console application web frontend, refers to the Console base URL of WEB service if console domain is
  15. # different from api or web app domain.
  16. # example: http://cloud.dify.ai
  17. CONSOLE_WEB_URL: ''
  18. # Password for admin user initialization.
  19. # If left unset, admin user will not be prompted for a password when creating the initial admin account.
  20. INIT_PASSWORD: ''
  21. # The base URL of console application api server, refers to the Console base URL of WEB service if console domain is
  22. # different from api or web app domain.
  23. # example: http://cloud.dify.ai
  24. CONSOLE_API_URL: ''
  25. # The URL prefix for Service API endpoints, refers to the base URL of the current API service if api domain is
  26. # different from console domain.
  27. # example: http://api.dify.ai
  28. SERVICE_API_URL: ''
  29. # The URL prefix for Web APP frontend, refers to the Web App base URL of WEB service if web app domain is different from
  30. # console or api domain.
  31. # example: http://udify.app
  32. APP_WEB_URL: ''
  33. # File preview or download Url prefix.
  34. # used to display File preview or download Url to the front-end or as Multi-model inputs;
  35. # Url is signed and has expiration time.
  36. FILES_URL: ''
  37. # When enabled, migrations will be executed prior to application startup and the application will start after the migrations have completed.
  38. MIGRATION_ENABLED: 'true'
  39. # The configurations of postgres database connection.
  40. # It is consistent with the configuration in the 'db' service below.
  41. DB_USERNAME: postgres
  42. DB_PASSWORD: difyai123456
  43. DB_HOST: db
  44. DB_PORT: 5432
  45. DB_DATABASE: dify
  46. # The configurations of redis connection.
  47. # It is consistent with the configuration in the 'redis' service below.
  48. REDIS_HOST: redis
  49. REDIS_PORT: 6379
  50. REDIS_USERNAME: ''
  51. REDIS_PASSWORD: difyai123456
  52. REDIS_USE_SSL: 'false'
  53. # use redis db 0 for redis cache
  54. REDIS_DB: 0
  55. # The configurations of celery broker.
  56. # Use redis as the broker, and redis db 1 for celery broker.
  57. CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
  58. # Specifies the allowed origins for cross-origin requests to the Web API, e.g. https://dify.app or * for all origins.
  59. WEB_API_CORS_ALLOW_ORIGINS: '*'
  60. # Specifies the allowed origins for cross-origin requests to the console API, e.g. https://cloud.dify.ai or * for all origins.
  61. CONSOLE_CORS_ALLOW_ORIGINS: '*'
  62. # CSRF Cookie settings
  63. # Controls whether a cookie is sent with cross-site requests,
  64. # providing some protection against cross-site request forgery attacks
  65. #
  66. # Default: `SameSite=Lax, Secure=false, HttpOnly=true`
  67. # This default configuration supports same-origin requests using either HTTP or HTTPS,
  68. # but does not support cross-origin requests. It is suitable for local debugging purposes.
  69. #
  70. # If you want to enable cross-origin support,
  71. # you must use the HTTPS protocol and set the configuration to `SameSite=None, Secure=true, HttpOnly=true`.
  72. #
  73. # The type of storage to use for storing user files. Supported values are `local` and `s3` and `azure-blob` and `google-storage`, Default: `local`
  74. STORAGE_TYPE: local
  75. # The path to the local storage directory, the directory relative the root path of API service codes or absolute path. Default: `storage` or `/home/john/storage`.
  76. # only available when STORAGE_TYPE is `local`.
  77. STORAGE_LOCAL_PATH: storage
  78. # The S3 storage configurations, only available when STORAGE_TYPE is `s3`.
  79. S3_ENDPOINT: 'https://xxx.r2.cloudflarestorage.com'
  80. S3_BUCKET_NAME: 'difyai'
  81. S3_ACCESS_KEY: 'ak-difyai'
  82. S3_SECRET_KEY: 'sk-difyai'
  83. S3_REGION: 'us-east-1'
  84. # The Azure Blob storage configurations, only available when STORAGE_TYPE is `azure-blob`.
  85. AZURE_BLOB_ACCOUNT_NAME: 'difyai'
  86. AZURE_BLOB_ACCOUNT_KEY: 'difyai'
  87. AZURE_BLOB_CONTAINER_NAME: 'difyai-container'
  88. AZURE_BLOB_ACCOUNT_URL: 'https://<your_account_name>.blob.core.windows.net'
  89. # The Google storage configurations, only available when STORAGE_TYPE is `google-storage`.
  90. GOOGLE_STORAGE_BUCKET_NAME: 'yout-bucket-name'
  91. GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64: 'your-google-service-account-json-base64-string'
  92. # The type of vector store to use. Supported values are `weaviate`, `qdrant`, `milvus`, `relyt`.
  93. VECTOR_STORE: weaviate
  94. # The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
  95. WEAVIATE_ENDPOINT: http://weaviate:8080
  96. # The Weaviate API key.
  97. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  98. # The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
  99. QDRANT_URL: http://qdrant:6333
  100. # The Qdrant API key.
  101. QDRANT_API_KEY: difyai123456
  102. # The Qdrant client timeout setting.
  103. QDRANT_CLIENT_TIMEOUT: 20
  104. # The Qdrant client enable gRPC mode.
  105. QDRANT_GRPC_ENABLED: 'false'
  106. # The Qdrant server gRPC mode PORT.
  107. QDRANT_GRPC_PORT: 6334
  108. # Milvus configuration Only available when VECTOR_STORE is `milvus`.
  109. # The milvus host.
  110. MILVUS_HOST: 127.0.0.1
  111. # The milvus host.
  112. MILVUS_PORT: 19530
  113. # The milvus username.
  114. MILVUS_USER: root
  115. # The milvus password.
  116. MILVUS_PASSWORD: Milvus
  117. # The milvus tls switch.
  118. MILVUS_SECURE: 'false'
  119. # relyt configurations
  120. RELYT_HOST: db
  121. RELYT_PORT: 5432
  122. RELYT_USER: postgres
  123. RELYT_PASSWORD: difyai123456
  124. RELYT_DATABASE: postgres
  125. # Mail configuration, support: resend, smtp
  126. MAIL_TYPE: ''
  127. # default send from email address, if not specified
  128. MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)'
  129. SMTP_SERVER: ''
  130. SMTP_PORT: 587
  131. SMTP_USERNAME: ''
  132. SMTP_PASSWORD: ''
  133. SMTP_USE_TLS: 'true'
  134. # the api-key for resend (https://resend.com)
  135. RESEND_API_KEY: ''
  136. RESEND_API_URL: https://api.resend.com
  137. # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
  138. SENTRY_DSN: ''
  139. # The sample rate for Sentry events. Default: `1.0`
  140. SENTRY_TRACES_SAMPLE_RATE: 1.0
  141. # The sample rate for Sentry profiles. Default: `1.0`
  142. SENTRY_PROFILES_SAMPLE_RATE: 1.0
  143. # Notion import configuration, support public and internal
  144. NOTION_INTEGRATION_TYPE: public
  145. NOTION_CLIENT_SECRET: you-client-secret
  146. NOTION_CLIENT_ID: you-client-id
  147. NOTION_INTERNAL_SECRET: you-internal-secret
  148. # The sandbox service endpoint.
  149. CODE_EXECUTION_ENDPOINT: "http://sandbox:8194"
  150. CODE_EXECUTION_API_KEY: dify-sandbox
  151. CODE_MAX_NUMBER: 9223372036854775807
  152. CODE_MIN_NUMBER: -9223372036854775808
  153. CODE_MAX_STRING_LENGTH: 80000
  154. TEMPLATE_TRANSFORM_MAX_LENGTH: 80000
  155. CODE_MAX_STRING_ARRAY_LENGTH: 30
  156. CODE_MAX_OBJECT_ARRAY_LENGTH: 30
  157. CODE_MAX_NUMBER_ARRAY_LENGTH: 1000
  158. depends_on:
  159. - db
  160. - redis
  161. volumes:
  162. # Mount the storage directory to the container, for storing user files.
  163. - ./volumes/app/storage:/app/api/storage
  164. # uncomment to expose dify-api port to host
  165. # ports:
  166. # - "5001:5001"
  167. # worker service
  168. # The Celery worker for processing the queue.
  169. worker:
  170. image: langgenius/dify-api:0.6.6
  171. restart: always
  172. environment:
  173. # Startup mode, 'worker' starts the Celery worker for processing the queue.
  174. MODE: worker
  175. # --- All the configurations below are the same as those in the 'api' service. ---
  176. # The log level for the application. Supported values are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
  177. LOG_LEVEL: INFO
  178. # A secret key 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`.
  179. # same as the API service
  180. SECRET_KEY: sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U
  181. # The configurations of postgres database connection.
  182. # It is consistent with the configuration in the 'db' service below.
  183. DB_USERNAME: postgres
  184. DB_PASSWORD: difyai123456
  185. DB_HOST: db
  186. DB_PORT: 5432
  187. DB_DATABASE: dify
  188. # The configurations of redis cache connection.
  189. REDIS_HOST: redis
  190. REDIS_PORT: 6379
  191. REDIS_USERNAME: ''
  192. REDIS_PASSWORD: difyai123456
  193. REDIS_DB: 0
  194. REDIS_USE_SSL: 'false'
  195. # The configurations of celery broker.
  196. CELERY_BROKER_URL: redis://:difyai123456@redis:6379/1
  197. # The type of storage to use for storing user files. Supported values are `local` and `s3` and `azure-blob`, Default: `local`
  198. STORAGE_TYPE: local
  199. STORAGE_LOCAL_PATH: storage
  200. # The S3 storage configurations, only available when STORAGE_TYPE is `s3`.
  201. S3_ENDPOINT: 'https://xxx.r2.cloudflarestorage.com'
  202. S3_BUCKET_NAME: 'difyai'
  203. S3_ACCESS_KEY: 'ak-difyai'
  204. S3_SECRET_KEY: 'sk-difyai'
  205. S3_REGION: 'us-east-1'
  206. # The Azure Blob storage configurations, only available when STORAGE_TYPE is `azure-blob`.
  207. AZURE_BLOB_ACCOUNT_NAME: 'difyai'
  208. AZURE_BLOB_ACCOUNT_KEY: 'difyai'
  209. AZURE_BLOB_CONTAINER_NAME: 'difyai-container'
  210. AZURE_BLOB_ACCOUNT_URL: 'https://<your_account_name>.blob.core.windows.net'
  211. # The type of vector store to use. Supported values are `weaviate`, `qdrant`, `milvus`, `relyt`.
  212. VECTOR_STORE: weaviate
  213. # The Weaviate endpoint URL. Only available when VECTOR_STORE is `weaviate`.
  214. WEAVIATE_ENDPOINT: http://weaviate:8080
  215. # The Weaviate API key.
  216. WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
  217. # The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
  218. QDRANT_URL: http://qdrant:6333
  219. # The Qdrant API key.
  220. QDRANT_API_KEY: difyai123456
  221. # The Qdrant clinet timeout setting.
  222. QDRANT_CLIENT_TIMEOUT: 20
  223. # The Qdrant client enable gRPC mode.
  224. QDRANT_GRPC_ENABLED: 'false'
  225. # The Qdrant server gRPC mode PORT.
  226. QDRANT_GRPC_PORT: 6334
  227. # Milvus configuration Only available when VECTOR_STORE is `milvus`.
  228. # The milvus host.
  229. MILVUS_HOST: 127.0.0.1
  230. # The milvus host.
  231. MILVUS_PORT: 19530
  232. # The milvus username.
  233. MILVUS_USER: root
  234. # The milvus password.
  235. MILVUS_PASSWORD: Milvus
  236. # The milvus tls switch.
  237. MILVUS_SECURE: 'false'
  238. # Mail configuration, support: resend
  239. MAIL_TYPE: ''
  240. # default send from email address, if not specified
  241. MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)'
  242. # the api-key for resend (https://resend.com)
  243. RESEND_API_KEY: ''
  244. RESEND_API_URL: https://api.resend.com
  245. # relyt configurations
  246. RELYT_HOST: db
  247. RELYT_PORT: 5432
  248. RELYT_USER: postgres
  249. RELYT_PASSWORD: difyai123456
  250. RELYT_DATABASE: postgres
  251. # Notion import configuration, support public and internal
  252. NOTION_INTEGRATION_TYPE: public
  253. NOTION_CLIENT_SECRET: you-client-secret
  254. NOTION_CLIENT_ID: you-client-id
  255. NOTION_INTERNAL_SECRET: you-internal-secret
  256. depends_on:
  257. - db
  258. - redis
  259. volumes:
  260. # Mount the storage directory to the container, for storing user files.
  261. - ./volumes/app/storage:/app/api/storage
  262. # Frontend web application.
  263. web:
  264. image: langgenius/dify-web:0.6.6
  265. restart: always
  266. environment:
  267. # The base URL of console application api server, refers to the Console base URL of WEB service if console domain is
  268. # different from api or web app domain.
  269. # example: http://cloud.dify.ai
  270. CONSOLE_API_URL: ''
  271. # The URL for Web APP api server, refers to the Web App base URL of WEB service if web app domain is different from
  272. # console or api domain.
  273. # example: http://udify.app
  274. APP_API_URL: ''
  275. # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
  276. SENTRY_DSN: ''
  277. # uncomment to expose dify-web port to host
  278. # ports:
  279. # - "3000:3000"
  280. # The postgres database.
  281. db:
  282. image: postgres:15-alpine
  283. restart: always
  284. environment:
  285. PGUSER: postgres
  286. # The password for the default postgres user.
  287. POSTGRES_PASSWORD: difyai123456
  288. # The name of the default postgres database.
  289. POSTGRES_DB: dify
  290. # postgres data directory
  291. PGDATA: /var/lib/postgresql/data/pgdata
  292. volumes:
  293. - ./volumes/db/data:/var/lib/postgresql/data
  294. # uncomment to expose db(postgresql) port to host
  295. # ports:
  296. # - "5432:5432"
  297. healthcheck:
  298. test: [ "CMD", "pg_isready" ]
  299. interval: 1s
  300. timeout: 3s
  301. retries: 30
  302. # The redis cache.
  303. redis:
  304. image: redis:6-alpine
  305. restart: always
  306. volumes:
  307. # Mount the redis data directory to the container.
  308. - ./volumes/redis/data:/data
  309. # Set the redis password when startup redis server.
  310. command: redis-server --requirepass difyai123456
  311. healthcheck:
  312. test: [ "CMD", "redis-cli", "ping" ]
  313. # uncomment to expose redis port to host
  314. # ports:
  315. # - "6379:6379"
  316. # The Weaviate vector store.
  317. weaviate:
  318. image: semitechnologies/weaviate:1.19.0
  319. restart: always
  320. volumes:
  321. # Mount the Weaviate data directory to the container.
  322. - ./volumes/weaviate:/var/lib/weaviate
  323. environment:
  324. # The Weaviate configurations
  325. # You can refer to the [Weaviate](https://weaviate.io/developers/weaviate/config-refs/env-vars) documentation for more information.
  326. QUERY_DEFAULTS_LIMIT: 25
  327. AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'false'
  328. PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
  329. DEFAULT_VECTORIZER_MODULE: 'none'
  330. CLUSTER_HOSTNAME: 'node1'
  331. AUTHENTICATION_APIKEY_ENABLED: 'true'
  332. AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih'
  333. AUTHENTICATION_APIKEY_USERS: 'hello@dify.ai'
  334. AUTHORIZATION_ADMINLIST_ENABLED: 'true'
  335. AUTHORIZATION_ADMINLIST_USERS: 'hello@dify.ai'
  336. # uncomment to expose weaviate port to host
  337. # ports:
  338. # - "8080:8080"
  339. # The DifySandbox
  340. sandbox:
  341. image: langgenius/dify-sandbox:0.1.0
  342. restart: always
  343. cap_add:
  344. # Why is sys_admin permission needed?
  345. # https://docs.dify.ai/getting-started/install-self-hosted/install-faq#id-16.-why-is-sys_admin-permission-needed
  346. - SYS_ADMIN
  347. environment:
  348. # The DifySandbox configurations
  349. API_KEY: dify-sandbox
  350. GIN_MODE: release
  351. WORKER_TIMEOUT: 15
  352. # Qdrant vector store.
  353. # uncomment to use qdrant as vector store.
  354. # (if uncommented, you need to comment out the weaviate service above,
  355. # and set VECTOR_STORE to qdrant in the api & worker service.)
  356. # qdrant:
  357. # image: langgenius/qdrant:v1.7.3
  358. # restart: always
  359. # volumes:
  360. # - ./volumes/qdrant:/qdrant/storage
  361. # environment:
  362. # QDRANT_API_KEY: 'difyai123456'
  363. # # uncomment to expose qdrant port to host
  364. # # ports:
  365. # # - "6333:6333"
  366. # # - "6334:6334"
  367. # The nginx reverse proxy.
  368. # used for reverse proxying the API service and Web service.
  369. nginx:
  370. image: nginx:latest
  371. restart: always
  372. volumes:
  373. - ./nginx/nginx.conf:/etc/nginx/nginx.conf
  374. - ./nginx/proxy.conf:/etc/nginx/proxy.conf
  375. - ./nginx/conf.d:/etc/nginx/conf.d
  376. #- ./nginx/ssl:/etc/ssl
  377. depends_on:
  378. - api
  379. - web
  380. ports:
  381. - "80:80"
  382. #- "443:443"

项目Dify on WeChat的拉取与部署(改编自作者大佬的教程)

创建Dify基础编排聊天助手应用

登录成功后,进入Dify页面,我们按照下方步骤创建一个基础编排聊天助手应用

image-os7s.png

  1. 点击页面上方的工作室
  2. 创建空白应用
  3. 应用类型选择聊天助手
  4. 聊天助手编排方式选择基础编排
  5. 选择应用图标并为应用填写一个名称,比如基础编排聊天助手
  6. 点击创建

Dify的配置较为多样化,也可以参考官方的教程进行个性化配置

在配置完成后,我们可以在右侧对话框进行测试,在测试完成后,进行如下操作

image-ejuk.png

  1. 发布
  2. 更新
  3. 访问API

我们此时就获得到了api秘钥和服务器地址

Docker进行部署
  1. git clone https://github.com/hanfangyuan4396/dify-on-wechat
  2. cd dify-on-wechat/docker # 进入docker目录
  3. # 配置dify的API和服务器地址
  4. vi docker-compose.yml
  5. # 我们配置environment字段即可
  6. environment:
  7. DIFY_API_BASE: '浪浪云ip+对应的端口地址'
  8. DIFY_API_KEY: 'app-api-key'
  9. DIFY_APP_TYPE: 'chatbot'
  10. MODEL: 'dify'
  11. SINGLE_CHAT_PREFIX: '[""]'
  12. SINGLE_CHAT_REPLY_PREFIX: '""'
  13. GROUP_CHAT_PREFIX: '["@bot"]'
  14. GROUP_NAME_WHITE_LIST: '["ALL_GROUP"]'
  15. # 字段详解
  16. #
  17. {
  18. "dify_api_base": "https://api.dify.ai/v1", # dify base url
  19. "dify_api_key": "app-xxx", # dify api key
  20. "dify_app_type": "chatbot", # dify应用类型 chatbot(对应聊天助手)/agent(对应Agent)/workflow(对应工作流),默认为chatbot
  21. "dify_convsersation_max_messages": 5, # dify目前不支持设置历史消息长度,暂时使用超过最大消息数清空会话的策略,缺点是没有滑动窗口,会突然丢失历史消息, 当前为5
  22. "channel_type": "wx", # 通道类型,当前为个人微信
  23. "model": "dify", # 模型名称,当前对应dify平台
  24. "single_chat_prefix": [""], # 私聊时文本需要包含该前缀才能触发机器人回复
  25. "single_chat_reply_prefix": "", # 私聊时自动回复的前缀,用于区分真人
  26. "group_chat_prefix": ["@bot"], # 群聊时包含该前缀则会触发机器人回复
  27. "group_name_white_list": ["ALL_GROUP"] # 机器人回复的群名称列表
  28. }
  1. docker compose up -d # 启动docker容器
  2. docker logs -f dify-on-wechat # 查看二维码并登录

如果作者大佬的项目对您有帮助请帮助大佬点一个star吧~

使用源码部署
  1. #安装依赖
  2. pip3 install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
  3. #安装扩展依赖
  4. pip3 install -r requirements-optional.txt -i https://mirrors.aliyun.com/pypi/simple
  5. #复制配置文件
  6. cp config-template.json config.json
  7. #启动
  8. python3 app.py

效果演示

1885614c166a66087c38350ae4406d8.jpg

81d875498990f4d9e83c89b701b20f1.jpg

服务器日志大概如下:

image-vmd7.png

四、Q&A

有什么问题可以进行提问,常见的问题我会总结为Q&A

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/652987
推荐阅读
相关标签
  

闽ICP备14008679号