zhayujie / chatgpt-on-wechat

基于大模型搭建的聊天机器人,同时支持 微信公众号、企业微信应用、飞书、钉钉 等接入,可选择GPT3.5/GPT-4o/GPT-o1/ Claude/文心一言/讯飞星火/通义千问/ Gemini/GLM-4/Claude/Kimi/LinkAI,能处理文本、语音和图片,访问操作系统和互联网,支持基于自有知识库进行定制企业智能客服。
https://docs.link-ai.tech/cow
MIT License
31.6k stars 8.22k forks source link

docker配置proxy后回复消息链接不上,使用clash订阅配置代理 #2338

Closed qq910696606 closed 1 month ago

qq910696606 commented 1 month ago

前置确认

⚠️ 搜索issues中是否已存在类似问题

操作系统类型?

Docker

运行的python版本是?

python 3.8

使用的chatgpt-on-wechat版本是?

Latest Release

运行的channel类型是?

wx(个人微信, itchat)

复现步骤 🕹

  1. 使用docker+服务器部署,clash服务器配置rule模式,开启后可以curl访问:

INFO[2024-10-14T10:38:25.186129666+08:00] [TCP] 127.0.0.1:51538 --> openai.com:80 match DomainSuffix(openai.com) using 🚀 节点选择[🇸🇬 [v1] 新加坡・02] INFO[2024-10-14T10:38:30.46380724+08:00] [TCP] 127.0.0.1:51544 --> api.openai.com:443 match DomainSuffix(openai.com) using 🚀 节点选择[🇸🇬 [v1] 新加坡・02]

[root@lavm-n220uj3l8e ~]# curl -L https://api.openai.com { "message": "Welcome to the OpenAI API! Documentation is available at https://platform.openai.com/docs/api-reference"

  1. docker-compose.yml配置proxy代理地址: OPEN_AI_API_KEY: 'XXXX' MODEL: '' PROXY: 'http://127.0.0.1:7890'
  2. 访问失败 [ERROR] 我连接不到你的网络

问题描述 😯

回复消息显示“我连接不到你的网络” [WARNING][2024-10-14 03:00:58][chat_gpt_bot.py:158] - [CHATGPT] APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by ProxyError('Unable to connect to proxy', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f539284f730>: Failed to establish a new connection: [Errno 111] Connection refused')))

终端日志 📒

[WARNING][2024-10-14 03:00:58][chat_gpt_bot.py:158] - [CHATGPT] APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by ProxyError('Unable to connect to proxy', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f539284f730>: Failed to establish a new connection: [Errno 111] Connection refused')))
[WARNING][2024-10-14 03:01:03][chat_gpt_bot.py:168] - [CHATGPT] 第1次重试
6vision commented 1 month ago

yml文件加个端口映射试试呢,把7890映射到宿主机的7890端口

qq910696606 commented 1 month ago

@6vision 加了端口映射启动docker 会占用宿主机clash 7890端口 [root@lavm-n220uj3l8e mihomo]# ./clash
ERRO[2024-10-14T14:18:46.870130327+08:00] Start HTTP server error: listen tcp :7890: bind: address already in use ERRO[2024-10-14T14:18:46.870142027+08:00] Start HTTP server error: listen tcp :7890: bind: address already in use

services: chatgpt-on-wechat: image: zhayujie/chatgpt-on-wechat container_name: chatgpt-on-wechat ports:

6vision commented 1 month ago

那试试直接python部署吧,不用docker了