baiyz0825 / corp-wechat-gptbot

chatgpt企业微信自建应用,支持上下文对话、图片生成、以及导出功能。Docker快速部署
37 stars 14 forks source link

提问 - Question Panel #4

Open baiyz0825 opened 1 year ago

baiyz0825 commented 1 year ago

问题统一这里进行提问与讨论

xujingkai commented 1 year ago

gptConfig.url配置之后未生效,看请求日志依然是api.openai.com。国内的机器,无法直接使用官方的api域名 time="2023-05-08 18:35:36" level="error" msg="CreateCompletionStream returned error: Post \"https://api.openai.com/v1/chat/completions\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)" func="github.com/baiyz0825/corp-webot/utils/openaiutils.SendReqAndGetTextResp" file="oepn_ai_utils.go"

baiyz0825 commented 1 year ago

国内机器ip都已经封了,需要自己走代理的

baiyz0825 commented 1 year ago

套一个cf warp你可以试一下,这个方案有些机器还可以用

srhinee commented 1 year ago

设置了代理,但是请求超时,这个可能是那些原因

[GIN] 2023/06/27 - 19:58:34 | 200 | 191.512µs | 10.88.0.50 | POST "/gpt?msg_signature=480c654a5055eb99671219991c9f844015faf59d&timestamp=1687867114&nonce=1687751484" time="2023-06-27 19:58:49" level="error" msg="CreateCompletionStream returned error: Post \"https://api.openai.com/v1/chat/completions\": dial tcp 103.252.115.59:443: connect: connection timed out" func="github.com/baiyz0825/corp-webot/utils/openaiutils.SendReqAndGetTextResp" file="oepn_ai_utils.go"

srhinee commented 1 year ago

代理在shell中是没问题的

root@iZwz9bifwgee1cfuklfumuZ ~/g/corp-wechat# curl https://api.openai.com/v1/chat/completions { "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 accessing 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 } }

baiyz0825 commented 1 year ago

设置了代理,但是请求超时,这个可能是那些原因

[GIN] 2023/06/27 - 19:58:34 | 200 | 191.512µs | 10.88.0.50 | POST "/gpt?msg_signature=480c654a5055eb99671219991c9f844015faf59d&timestamp=1687867114&nonce=1687751484" time="2023-06-27 19:58:49" level="error" msg="CreateCompletionStream returned error: Post "https://api.openai.com/v1/chat/completions\": dial tcp 103.252.115.59:443: connect: connection timed out" func="github.com/baiyz0825/corp-webot/utils/openaiutils.SendReqAndGetTextResp" file="oepn_ai_utils.go"

已经修复了,重新拉取一下镜像就可以,代理测试成功或者失败控制台日志会显示,配置Http代理就行,格式http://192.168.0.44:7890 image

Jack-bin183 commented 10 months ago

建好之后怎么把这个自建机器人让微信端可用呢? 还是说只能在企业微信使用呀

baiyz0825 commented 10 months ago

建好之后怎么把这个自建机器人让微信端可用呢? 还是说只能在企业微信使用呀

企业微信开启微信插件就可以在微信中使用了

image
Jack-bin183 commented 10 months ago

建好之后怎么把这个自建机器人让微信端可用呢? 还是说只能在企业微信使用呀

企业微信开启微信插件就可以在微信中使用了 image

谢谢回答,解决了。 但是又有一个更难受的问题,就是 回答很容易超时

有时候【你好】,gpt3.5都要等10秒左右甚至还有很大可能超时。换成gpt4会好一些,虽然还是慢但起码不会超时了【gpt4太太太贵了】。

我看网页版的哪些gpt3.5都很少情况会超时,这怎么解决呢?

baiyz0825 commented 10 months ago

建好之后怎么把这个自建机器人让微信端可用呢? 还是说只能在企业微信使用呀

企业微信开启微信插件就可以在微信中使用了 image

谢谢回答,解决了。 但是又有一个更难受的问题,就是 回答很容易超时

有时候【你好】,gpt3.5都要等10秒左右甚至还有很大可能超时。换成gpt4会好一些,虽然还是慢但起码不会超时了【gpt4太太太贵了】。

我看网页版的哪些gpt3.5都很少情况会超时,这怎么解决呢?

走api因为要从机器人读取之后做转发到微信,之后微信服务器在转到你的微信里面,中存在网络延迟,这个具体时间我没算过,这个得自己改下代码优化一下数据转发的部分,做分片或者其他的优化网络方式