Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

机器人请求失败!!! #153

Open
hhfeng616 opened this issue Apr 1, 2023 · 15 comments
Open

机器人请求失败!!! #153

hhfeng616 opened this issue Apr 1, 2023 · 15 comments
Labels
question Further information is requested

Comments

@hhfeng616
Copy link

hhfeng616 commented Apr 1, 2023

部署的阿里云服务器,开启了sockes5代理端口是1080看看下面的错误是什么原因导致的!!!
请求openai失败了,错误信息:Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 172.17.0.1:1080: connect: connection refused

@daryl

docker-compose.yml如下面所示

version: '3'

services:
  chatgpt:
    container_name: chatgpt
    image: dockerproxy.com/eryajf/chatgpt-dingtalk:latest
    restart: always
    environment:
      APIKEY: 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  # 你的 api_key
      BASE_URL: ""  # 如果你想指定请求url的地址,可通过这个参数进行配置,不需要再添加 /v1,如果留空则默认为官方地址,
      MODEL: "gpt-3.5-turbo" # 指定模型
      SESSION_TIMEOUT: 600 # 超时时间
      HTTP_PROXY: http://host.docker.internal:1080 # 配置代理,注意host.docker.internal会解析到容器所在的宿主机IP,因此只需要更改端口即可,另外如果服务器在国外,则这里留空即可
      DEFAULT_MODE: "单聊" # 聊天模式
      MAX_REQUEST: 0 # 单人单日请求次数限制,默认为0,即不限制
      PORT: 8090 # 指定服务启动端口,默认为 8090,容器化部署时,不需要调整
      SERVICE_URL: "http://121.196.237.40:8090"  # 指定服务的地址,就是钉钉机器人配置的回调地址,比如: http://chat.eryajf.net
    ports:
      - "8090:8090"
    extra_hosts:
      - host.docker.internal:host-gateway

开启代理是sockes5代理是没有问题的!!!

root@UnitServer:~/data/docker_data/chatgpt-dingtalk# export ALL_PROXY=socks5://127.0.0.1:1080
root@UnitServer:~/data/docker_data/chatgpt-dingtalk# curl http://ipinfo.io
{
  "ip": "194.146.25.114",
  "city": "London",
  "region": "England",
  "country": "GB",
  "loc": "51.5085,-0.1257",
  "org": "AS210329 Kamatera Inc",
  "postal": "EC1A",
  "timezone": "Europe/London",
  "readme": "https://ipinfo.io/missingauth"
}root@UnitServer:~/data/docker_data/chatgpt-dingtalk# 

root@UnitServer:~/data/docker_data/chatgpt-dingtalk# curl --proxy socks5h://127.0.0.1:1080 https://api.openai.com/v1/models
{
  "error": {
    "message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accesing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}
root@UnitServer:~/data/docker_data/chatgpt-dingtalk# 

image

@hhfeng616 hhfeng616 added the question Further information is requested label Apr 1, 2023
@hhfeng616
Copy link
Author

hhfeng616 commented Apr 1, 2023

doucker容器的ifconfig输出结果如下

root@UnitServer:~/data/docker_data/chatgpt-dingtalk# ifconfig
br-f531dfb7219d: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.18.0.1  netmask 255.255.0.0  broadcast 172.18.255.255
        ether 02:42:56:31:ba:7d  txqueuelen 0  (Ethernet)
        RX packets 1099  bytes 77701 (75.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1179  bytes 181834 (177.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:a0:fe:36:01  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.23.221.210  netmask 255.255.240.0  broadcast 172.23.223.255
        ether 00:16:3e:08:88:be  txqueuelen 1000  (Ethernet)
        RX packets 309448  bytes 56717100 (54.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 490256  bytes 120328815 (114.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1063  bytes 205363 (200.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1063  bytes 205363 (200.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vethf42c7da: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 66:f4:f8:a5:2a:dc  txqueuelen 0  (Ethernet)
        RX packets 86  bytes 7745 (7.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 86  bytes 15855 (15.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@UnitServer:~/data/docker_data/chatgpt-dingtalk# 

@hhfeng616
Copy link
Author

hhfeng616 commented Apr 1, 2023

时时运行输出的日志如下所示

| INFO [dingtalk callback parameters: dingbot.ReceiveMsg{ConversationID:"cidtVeI5kNf+DHSYfxLy/Pw3g==", AtUsers:[]struct { DingtalkID string "json:\"dingtalkId\"" }{struct { DingtalkID string "json:\"dingtalkId\"" }{DingtalkID:"$:LWCP_v1:$A8rRtZ2X/++mm8UpJJOEFHm+HTLnF90R"}}, ChatbotUserID:"$:LWCP_v1:$A8rRtZ2X/++mm8UpJJOEFHm+HTLnF90R", MsgID:"msgZjq1f8YZcfIvTi/upOfDfg==", SenderNick:"Daryl", IsAdmin:true, SenderStaffId:"manager957", SessionWebhookExpiredTime:1680362551853, CreateAt:1680357151704, ConversationType:"2", SenderID:"$:LWCP_v1:$7c8lREFsakUhrmjbv+Sn6onKL27nc1Am", ConversationTitle:"未来可期", IsInAtList:true, SessionWebhook:"https://oapi.dingtalk.com/robot/sendBySession?session=c7047ff966b9195044053ed012fd10d1", Text:dingbot.Text{Content:" lot"}, RobotCode:"ding6ze1fukrrr8p7kwk", Msgtype:"text"}]
chatgpt    | INFO [after generate prompt: "lot"]
chatgpt    | INFO [gpt request error: Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 172.17.0.1:1080: connect: connection refused]
chatgpt    | WARN [get gpt result falied: <nil>]

感觉问题就出在请求api.openai.com接口不通?服务器用的国内阿里云,端口都开放了,挂的梯子是SSR开的socks5代理
export ALL_PROXY=socks5://127.0.0.1:1080设置之后可以通过curl --proxy socks5h://127.0.0.1:1080 https://api.openai.com/v1/chat/completions访问到接口,就是不知道需要改哪里的设置才可以,是docker-compose中的 HTTP_PROXY: http://host.docker.internal:1080 # 这行代码要修改吗?

@WinMin
Copy link
Contributor

WinMin commented Apr 2, 2023

chatgpt | INFO [gpt request error: Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 172.17.0.1:1080: connect: connection refused]

看这个报错
chatgpt | INFO [gpt request error: Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 172.17.0.1:1080: connect: connection refused]

看起来是你容器连不到你容器外的代理端口

@hhfeng616
Copy link
Author

chatgpt | INFO [gpt request error: Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 172.17.0.1:1080: connect: connection refused]

看这个报错 chatgpt | INFO [gpt request error: Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 172.17.0.1:1080: connect: connection refused]

看起来是你容器连不到你容器外的代理端口

HTTP_PROXY="socks5h://host.docker.internal:1080"改成这样吗

@WinMin
Copy link
Contributor

WinMin commented Apr 2, 2023

chatgpt | INFO [gpt request error: Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 172.17.0.1:1080: connect: connection refused]

看这个报错 chatgpt | INFO [gpt request error: Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 172.17.0.1:1080: connect: connection refused]
看起来是你容器连不到你容器外的代理端口

HTTP_PROXY="socks5h://host.docker.internal:1080"改成这样吗

你这代理不支持 http 代理吗?

@hhfeng616
Copy link
Author

hhfeng616 commented Apr 2, 2023

chatgpt | INFO [gpt request error: Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 172.17.0.1:1080: connect: connection refused]

看这个报错 chatgpt | INFO [gpt request error: Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 172.17.0.1:1080: connect: connection refused]
看起来是你容器连不到你容器外的代理端口

HTTP_PROXY="socks5h://host.docker.internal:1080"改成这样吗

你这代理不支持 http 代理吗?

买的梯子应该支持就是不知道怎么弄,新手一个搞了几天了还是不行,阿里云服务器上面用的shadowsocks-cli代理的
image

@hhfeng616
Copy link
Author

chatgpt | INFO [gpt request error: Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 172.17.0.1:1080: connect: connection refused]

看这个报错 chatgpt | INFO [gpt request error: Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 172.17.0.1:1080: connect: connection refused]
看起来是你容器连不到你容器外的代理端口

HTTP_PROXY="socks5h://host.docker.internal:1080"改成这样吗

你这代理不支持 http 代理吗?

买的梯子应该支持就是不知道怎么弄,新手一个搞了几天了还是不行,阿里云服务器上面用的shadowsocks-cli代理的 image
HTTP_PROXY="socks5h://host.docker.internal:1080"这样还是不行感觉还是设置有问题host.docker.internal这个是127.0.0.1么还是我阿里云服务器的外网IP,宿主的所有请求必须类似这样的curl --proxy socks5h://127.0.0.1:1080 https://api.openai.com/v1/models.... docker里面的chatgpt-dingtalk直接访问不行 需要用到外面的代理才可以?

@baby9
Copy link

baby9 commented Apr 2, 2023

看起来你的阿里云服务器买的是国内的吧,你需要在服务器上开启代理
你需要把代理端口监听在docker0网卡上,listen 172.17.0.1:1080,最好是以http协议,作者的项目没有提到对socks的支持
docker run时设置环境变量 -e HTTP_PROXY=“http://172.17.0.1:1080”

@baby9
Copy link

baby9 commented Apr 2, 2023

看起来你的阿里云服务器买的是国内的吧,你需要在服务器上开启代理 你需要把代理端口监听在docker0网卡上,listen 172.17.0.1:1080,最好是以http协议,作者的项目没有提到对socks的支持 docker run时设置环境变量 -e HTTP_PROXY=“http://172.17.0.1:1080”

以docker网桥模式启动,--add-host="host.docker.internal:host-gateway"这一步就不需要了

@eryajf
Copy link
Owner

eryajf commented Apr 2, 2023

看起来你的阿里云服务器买的是国内的吧,你需要在服务器上开启代理 你需要把代理端口监听在docker0网卡上,listen 172.17.0.1:1080,最好是以http协议,作者的项目没有提到对socks的支持 docker run时设置环境变量 -e HTTP_PROXY=“http://172.17.0.1:1080”

最新的readme已做了说明:

image

@hhfeng616
Copy link
Author

hhfeng616 commented Apr 2, 2023

172.17.0.1

docker run -itd --name chatgpt -p 8090:8090 -e APIKEY=sk-Sq5Iys65nLi6ECu72C44T3BlbkFJw4****="" -e MODEL="gpt-3.5-turbo" -e SESSION_TIMEOUT=600 -e HTTP_PROXY="socks5h://172.17.0.1:1080" -e DEFAULT_MODE="单聊" -e MAX_REQUEST=0 -e PORT=8090 -e SERVICE_URL="http://121.196.237.40:8090" -e CHAT_TYPE="0" --restart=always dockerproxy.com/eryajf/chatgpt-dingtalk:latest
改成这样了没有以前的错误了现在是其他的错误
{"log":"\u001b]10;?\u001b\\\u001b[6n\u001b]11;?\u001b\\\u001b[6n2023/04/02 19:58:41.966931 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 1\r\n","stream":"stdout","time":"2023-04-02T11:58:41.967225611Z"} {"log":"2023/04/02 19:58:53.975368 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 2\r\n","stream":"stdout","time":"2023-04-02T11:58:53.975628212Z"} {"log":"2023/04/02 19:59:05.983170 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 3\r\n","stream":"stdout","time":"2023-04-02T11:59:05.983409096Z"} {"log":"2023/04/02 19:59:17.991794 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 4\r\n","stream":"stdout","time":"2023-04-02T11:59:17.992280844Z"} {"log":"INFO [🚀 The HTTP Server is running on :8090]\r\n","stream":"stdout","time":"2023-04-02T11:59:17.992325647Z"} {"log":"INFO [dingtalk callback parameters: dingbot.ReceiveMsg{ConversationID:\"cidYO9AWtiXFrRV3bPQZa2Adft8hORVjGtTzKW4dtmDcDQ=\", AtUsers:[]struct { DingtalkID string \"json:\\\"dingtalkId\\\"\" }(nil), ChatbotUserID:\"$:LWCP_v1:$8Hd7LMU13qGG9ubDeFng2dLtq+1Rv5d1\", MsgID:\"msg1WKzHtRixA3p36ELftWgpw==\", SenderNick:\"Daryl\", IsAdmin:true, SenderStaffId:\"manager957\", SessionWebhookExpiredTime:1680442169550, CreateAt:1680436769303, ConversationType:\"1\", SenderID:\"$:LWCP_v1:$7c8lREFsakUhrmjbv+Sn6onKL27nc1Am\", ConversationTitle:\"\", IsInAtList:false, SessionWebhook:\"https://oapi.dingtalk.com/robot/sendBySession?session=ef79c594cd20f349791be88fa07f3d2b\", Text:dingbot.Text{Content:\"@44\"}, RobotCode:\"ding6ze1fukrrr8p7kwk\", Msgtype:\"text\"}]\r\n","stream":"stdout","time":"2023-04-02T11:59:29.659340235Z"} {"log":"INFO [after generate prompt: \"@44\"]\r\n","stream":"stdout","time":"2023-04-02T11:59:29.659378478Z"}
image

@baby9
Copy link

baby9 commented Apr 2, 2023

172.17.0.1

docker run -itd --name chatgpt -p 8090:8090 -e APIKEY=sk-Sq5Iys65nLi6ECu72C44T3BlbkFJw4****="" -e MODEL="gpt-3.5-turbo" -e SESSION_TIMEOUT=600 -e HTTP_PROXY="socks5h://172.17.0.1:1080" -e DEFAULT_MODE="单聊" -e MAX_REQUEST=0 -e PORT=8090 -e SERVICE_URL="http://121.196.237.40:8090" -e CHAT_TYPE="0" --restart=always dockerproxy.com/eryajf/chatgpt-dingtalk:latest 改成这样了没有以前的错误了现在是其他的错误 {"log":"\u001b]10;?\u001b\\\u001b[6n\u001b]11;?\u001b\\\u001b[6n2023/04/02 19:58:41.966931 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 1\r\n","stream":"stdout","time":"2023-04-02T11:58:41.967225611Z"} {"log":"2023/04/02 19:58:53.975368 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 2\r\n","stream":"stdout","time":"2023-04-02T11:58:53.975628212Z"} {"log":"2023/04/02 19:59:05.983170 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 3\r\n","stream":"stdout","time":"2023-04-02T11:59:05.983409096Z"} {"log":"2023/04/02 19:59:17.991794 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 4\r\n","stream":"stdout","time":"2023-04-02T11:59:17.992280844Z"} {"log":"INFO [🚀 The HTTP Server is running on :8090]\r\n","stream":"stdout","time":"2023-04-02T11:59:17.992325647Z"} {"log":"INFO [dingtalk callback parameters: dingbot.ReceiveMsg{ConversationID:\"cidYO9AWtiXFrRV3bPQZa2Adft8hORVjGtTzKW4dtmDcDQ=\", AtUsers:[]struct { DingtalkID string \"json:\\\"dingtalkId\\\"\" }(nil), ChatbotUserID:\"$:LWCP_v1:$8Hd7LMU13qGG9ubDeFng2dLtq+1Rv5d1\", MsgID:\"msg1WKzHtRixA3p36ELftWgpw==\", SenderNick:\"Daryl\", IsAdmin:true, SenderStaffId:\"manager957\", SessionWebhookExpiredTime:1680442169550, CreateAt:1680436769303, ConversationType:\"1\", SenderID:\"$:LWCP_v1:$7c8lREFsakUhrmjbv+Sn6onKL27nc1Am\", ConversationTitle:\"\", IsInAtList:false, SessionWebhook:\"https://oapi.dingtalk.com/robot/sendBySession?session=ef79c594cd20f349791be88fa07f3d2b\", Text:dingbot.Text{Content:\"@44\"}, RobotCode:\"ding6ze1fukrrr8p7kwk\", Msgtype:\"text\"}]\r\n","stream":"stdout","time":"2023-04-02T11:59:29.659340235Z"} {"log":"INFO [after generate prompt: \"@44\"]\r\n","stream":"stdout","time":"2023-04-02T11:59:29.659378478Z"} image

作者刚才更新了,重新拉取镜像部署

@eryajf
Copy link
Owner

eryajf commented Apr 3, 2023

172.17.0.1

docker run -itd --name chatgpt -p 8090:8090 -e APIKEY=sk-Sq5Iys65nLi6ECu72C44T3BlbkFJw4****="" -e MODEL="gpt-3.5-turbo" -e SESSION_TIMEOUT=600 -e HTTP_PROXY="socks5h://172.17.0.1:1080" -e DEFAULT_MODE="单聊" -e MAX_REQUEST=0 -e PORT=8090 -e SERVICE_URL="http://121.196.237.40:8090" -e CHAT_TYPE="0" --restart=always dockerproxy.com/eryajf/chatgpt-dingtalk:latest 改成这样了没有以前的错误了现在是其他的错误 {"log":"\u001b]10;?\u001b\\\u001b[6n\u001b]11;?\u001b\\\u001b[6n2023/04/02 19:58:41.966931 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 1\r\n","stream":"stdout","time":"2023-04-02T11:58:41.967225611Z"} {"log":"2023/04/02 19:58:53.975368 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 2\r\n","stream":"stdout","time":"2023-04-02T11:58:53.975628212Z"} {"log":"2023/04/02 19:59:05.983170 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 3\r\n","stream":"stdout","time":"2023-04-02T11:59:05.983409096Z"} {"log":"2023/04/02 19:59:17.991794 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 4\r\n","stream":"stdout","time":"2023-04-02T11:59:17.992280844Z"} {"log":"INFO [🚀 The HTTP Server is running on :8090]\r\n","stream":"stdout","time":"2023-04-02T11:59:17.992325647Z"} {"log":"INFO [dingtalk callback parameters: dingbot.ReceiveMsg{ConversationID:\"cidYO9AWtiXFrRV3bPQZa2Adft8hORVjGtTzKW4dtmDcDQ=\", AtUsers:[]struct { DingtalkID string \"json:\\\"dingtalkId\\\"\" }(nil), ChatbotUserID:\"$:LWCP_v1:$8Hd7LMU13qGG9ubDeFng2dLtq+1Rv5d1\", MsgID:\"msg1WKzHtRixA3p36ELftWgpw==\", SenderNick:\"Daryl\", IsAdmin:true, SenderStaffId:\"manager957\", SessionWebhookExpiredTime:1680442169550, CreateAt:1680436769303, ConversationType:\"1\", SenderID:\"$:LWCP_v1:$7c8lREFsakUhrmjbv+Sn6onKL27nc1Am\", ConversationTitle:\"\", IsInAtList:false, SessionWebhook:\"https://oapi.dingtalk.com/robot/sendBySession?session=ef79c594cd20f349791be88fa07f3d2b\", Text:dingbot.Text{Content:\"@44\"}, RobotCode:\"ding6ze1fukrrr8p7kwk\", Msgtype:\"text\"}]\r\n","stream":"stdout","time":"2023-04-02T11:59:29.659340235Z"} {"log":"INFO [after generate prompt: \"@44\"]\r\n","stream":"stdout","time":"2023-04-02T11:59:29.659378478Z"} image

作者刚才更新了,重新拉取镜像部署

再拉取下最新镜像,另外注意看下readme的启动命令说明,最新版本添加了几个环境变量

@hhfeng616
Copy link
Author

hhfeng616 commented Apr 7, 2023

172.17.0.1

docker run -itd --name chatgpt -p 8090:8090 -e APIKEY=sk-Sq5Iys65nLi6ECu72C44T3BlbkFJw4****="" -e MODEL="gpt-3.5-turbo" -e SESSION_TIMEOUT=600 -e HTTP_PROXY="socks5h://172.17.0.1:1080" -e DEFAULT_MODE="单聊" -e MAX_REQUEST=0 -e PORT=8090 -e SERVICE_URL="http://121.196.237.40:8090" -e CHAT_TYPE="0" --restart=always dockerproxy.com/eryajf/chatgpt-dingtalk:latest 改成这样了没有以前的错误了现在是其他的错误 {"log":"\u001b]10;?\u001b\\\u001b[6n\u001b]11;?\u001b\\\u001b[6n2023/04/02 19:58:41.966931 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 1\r\n","stream":"stdout","time":"2023-04-02T11:58:41.967225611Z"} {"log":"2023/04/02 19:58:53.975368 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 2\r\n","stream":"stdout","time":"2023-04-02T11:58:53.975628212Z"} {"log":"2023/04/02 19:59:05.983170 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 3\r\n","stream":"stdout","time":"2023-04-02T11:59:05.983409096Z"} {"log":"2023/04/02 19:59:17.991794 ERROR RESTY Get \"https://api.openai.com/dashboard/billing/credit_grants\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 4\r\n","stream":"stdout","time":"2023-04-02T11:59:17.992280844Z"} {"log":"INFO [🚀 The HTTP Server is running on :8090]\r\n","stream":"stdout","time":"2023-04-02T11:59:17.992325647Z"} {"log":"INFO [dingtalk callback parameters: dingbot.ReceiveMsg{ConversationID:\"cidYO9AWtiXFrRV3bPQZa2Adft8hORVjGtTzKW4dtmDcDQ=\", AtUsers:[]struct { DingtalkID string \"json:\\\"dingtalkId\\\"\" }(nil), ChatbotUserID:\"$:LWCP_v1:$8Hd7LMU13qGG9ubDeFng2dLtq+1Rv5d1\", MsgID:\"msg1WKzHtRixA3p36ELftWgpw==\", SenderNick:\"Daryl\", IsAdmin:true, SenderStaffId:\"manager957\", SessionWebhookExpiredTime:1680442169550, CreateAt:1680436769303, ConversationType:\"1\", SenderID:\"$:LWCP_v1:$7c8lREFsakUhrmjbv+Sn6onKL27nc1Am\", ConversationTitle:\"\", IsInAtList:false, SessionWebhook:\"https://oapi.dingtalk.com/robot/sendBySession?session=ef79c594cd20f349791be88fa07f3d2b\", Text:dingbot.Text{Content:\"@44\"}, RobotCode:\"ding6ze1fukrrr8p7kwk\", Msgtype:\"text\"}]\r\n","stream":"stdout","time":"2023-04-02T11:59:29.659340235Z"} {"log":"INFO [after generate prompt: \"@44\"]\r\n","stream":"stdout","time":"2023-04-02T11:59:29.659378478Z"} image

作者刚才更新了,重新拉取镜像部署

再拉取下最新镜像,另外注意看下readme的启动命令说明,最新版本添加了几个环境变量

image
折腾了这么久用的二进制包部署成功了!!!!

@sscoo
Copy link

sscoo commented Apr 29, 2023

部署的阿里云服务器,开启了sockes5代理端口是1080看看下面的错误是什么原因导致的!!! 请求openai失败了,错误信息:Post "https://api.openai.com/v1/chat/completions": proxyconnect tcp: dial tcp 172.17.0.1:1080: connect: connection refused

@daryl

docker-compose.yml如下面所示

version: '3'

services:
  chatgpt:
    container_name: chatgpt
    image: dockerproxy.com/eryajf/chatgpt-dingtalk:latest
    restart: always
    environment:
      APIKEY: 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  # 你的 api_key
      BASE_URL: ""  # 如果你想指定请求url的地址,可通过这个参数进行配置,不需要再添加 /v1,如果留空则默认为官方地址,
      MODEL: "gpt-3.5-turbo" # 指定模型
      SESSION_TIMEOUT: 600 # 超时时间
      HTTP_PROXY: http://host.docker.internal:1080 # 配置代理,注意host.docker.internal会解析到容器所在的宿主机IP,因此只需要更改端口即可,另外如果服务器在国外,则这里留空即可
      DEFAULT_MODE: "单聊" # 聊天模式
      MAX_REQUEST: 0 # 单人单日请求次数限制,默认为0,即不限制
      PORT: 8090 # 指定服务启动端口,默认为 8090,容器化部署时,不需要调整
      SERVICE_URL: "http://121.196.237.40:8090"  # 指定服务的地址,就是钉钉机器人配置的回调地址,比如: http://chat.eryajf.net
    ports:
      - "8090:8090"
    extra_hosts:
      - host.docker.internal:host-gateway

开启代理是sockes5代理是没有问题的!!!

root@UnitServer:~/data/docker_data/chatgpt-dingtalk# export ALL_PROXY=socks5://127.0.0.1:1080
root@UnitServer:~/data/docker_data/chatgpt-dingtalk# curl http://ipinfo.io
{
  "ip": "194.146.25.114",
  "city": "London",
  "region": "England",
  "country": "GB",
  "loc": "51.5085,-0.1257",
  "org": "AS210329 Kamatera Inc",
  "postal": "EC1A",
  "timezone": "Europe/London",
  "readme": "https://ipinfo.io/missingauth"
}root@UnitServer:~/data/docker_data/chatgpt-dingtalk# 
root@UnitServer:~/data/docker_data/chatgpt-dingtalk# curl --proxy socks5h://127.0.0.1:1080 https://api.openai.com/v1/models
{
  "error": {
    "message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accesing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}
root@UnitServer:~/data/docker_data/chatgpt-dingtalk# 

image

key不要用明文写出来啊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants