我的dify服务器是在内网环境,首先它需要通过代理去调用 LLM,但打开代理后调用 dify weaviate 服务会报错:Meta endpoint! Unexpected status code: 502, with response body: None. 所以,需要做的是:既要在调用LLM的时候走代理,又要调用 dify weaviate 服务的时候不走代理。 配置如下:
dify 是通过 docker compose 的方式运行起来的, 所以需要编辑 dify 的 docker-compose.yaml 文件。
... services: # API service api: image: langgenius/dify-api:0.7.1 restart: always environment: # Use the shared environment variables. <<: *shared-api-worker-env # Startup mode, 'api' starts the API server. MODE: api # 设置代理 HTTP_PROXY: http://my-proxy.com:3128 HTTPS_PROXY: http://my-proxy.com:3128 # 不走代理的情况: 把 weaviate 服务添加到里面 NO_PROXY: localhost,127.0.0.1,weaviate depends_on: - db - redis volumes: # Mount the storage directory to the container, for storing user files. - ./volumes/app/storage:/app/api/storage networks: - ssrf_proxy_network - default # worker service # The Celery worker for processing the queue. worker: image: langgenius/dify-api:0.7.1 restart: always environment: # Use the shared environment variables. <<: *shared-api-worker-env # Startup mode, 'worker' starts the Celery worker for processing the queue. MODE: worker # 设置代理 HTTP_PROXY: http://my-proxy.com:3128 HTTPS_PROXY: http://my-proxy.com:3128 # 不走代理的情况: 把 weaviate 服务添加到里面 NO_PROXY: localhost,127.0.0.1,weaviate depends_on: - db - redis volumes: # Mount the storage directory to the container, for storing user files. - ./volumes/app/storage:/app/api/storage networks: - ssrf_proxy_network - default # dify 的其他服务就不需要配置代理的设置了 ...
参考链接:
https://github.com/langgenius/dify/issues/4736
https://github.com/langgenius/dify/issues/734
标签:status,body,None,code,dify,endpoint,502 From: https://www.cnblogs.com/neozheng/p/18400589