chatgpt-on-wechat
chatgpt-on-wechat copied to clipboard
哪位大哥看一下总是返回异常
LOG OUT! Loading the contact, this may take a little while. Login successfully as Chatgpt体验版Bot Start auto replying. [INFO][2023-03-26 20:05:55][bridge.py:28] - create bot chatGPT for chat [INFO][2023-03-26 20:05:55][chat_gpt_bot.py:32] - [OPEN_AI] query=你好 [ERROR][2023-03-26 20:05:55][wechat_channel.py:29] - Worker return exception: module 'openai.error' has no attribute 'Timeout' Traceback (most recent call last): File "/root/chatgpt-on-wechat/bot/chatgpt/chat_gpt_bot.py", line 100, in reply_text response = openai.ChatCompletion.create( AttributeError: module 'openai' has no attribute 'ChatCompletion'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/root/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 210, in handle
reply = super().build_reply_content(context.content, context)
File "/root/chatgpt-on-wechat/channel/channel.py", line 33, in build_reply_content
return Bridge().fetch_reply_content(query, context)
File "/root/chatgpt-on-wechat/bridge/bridge.py", line 42, in fetch_reply_content
return self.get_bot("chat").reply(query, context)
File "/root/chatgpt-on-wechat/bot/chatgpt/chat_gpt_bot.py", line 55, in reply
reply_content = self.reply_text(session, session_id, 0)
File "/root/chatgpt-on-wechat/bot/chatgpt/chat_gpt_bot.py", line 121, in reply_text
except openai.error.Timeout as e:
AttributeError: module 'openai.error' has no attribute 'Timeout'
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 710, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 450, in send
timeout=timeout
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 788, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.6/site-packages/urllib3/packages/six.py", line 769, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 710, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/root/chatgpt-on-wechat/lib/itchat/components/login.py", line 296, in maintain_loop msgList, contactList = self.get_msg() File "/root/chatgpt-on-wechat/lib/itchat/components/login.py", line 384, in get_msg headers=headers, timeout=config.TIMEOUT) File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 577, in post return self.request('POST', url, data=data, json=json, **kwargs) File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 529, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 645, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 501, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
[INFO][2023-03-26 20:07:52][chat_gpt_bot.py:32] - [OPEN_AI] query=你好 [ERROR][2023-03-26 20:07:52][wechat_channel.py:29] - Worker return exception: module 'openai.error' has no attribute 'Timeout' NoneType: None ctrl+c ps -ef | grep app.py | grep -v grep [ERROR][2023-03-26 20:11:57][wechat_channel.py:29] - Worker return exception: list index out of range NoneType: None [INFO][2023-03-26 20:12:13][chat_gpt_bot.py:32] - [OPEN_AI] query=@bot [ERROR][2023-03-26 20:12:13][wechat_channel.py:29] - Worker return exception: module 'openai.error' has no attribute 'Timeout' NoneType: None
我也是用一段时间会报异常,然后得扫码重新登陆:
`Traceback (most recent call last): File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 665, in urlopen httplib_response = self._make_request( File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 421, in _make_request six.raise_from(e, None) File "
", line 3, in raise_from File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 416, in _make_request httplib_response = conn.getresponse() File "/usr/lib/python3.8/http/client.py", line 1348, in getresponse response.begin() File "/usr/lib/python3.8/http/client.py", line 316, in begin version, status, reason = self._read_status() File "/usr/lib/python3.8/http/client.py", line 285, in _read_status raise RemoteDisconnected("Remote end closed connection without" http.client.RemoteDisconnected: Remote end closed connection without response During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 719, in urlopen retries = retries.increment( File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 400, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/lib/python3/dist-packages/six.py", line 702, in reraise raise value.with_traceback(tb) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 665, in urlopen httplib_response = self._make_request( File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 421, in _make_request six.raise_from(e, None) File "
", line 3, in raise_from File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 416, in _make_request httplib_response = conn.getresponse() File "/usr/lib/python3.8/http/client.py", line 1348, in getresponse response.begin() File "/usr/lib/python3.8/http/client.py", line 316, in begin version, status, reason = self._read_status() File "/usr/lib/python3.8/http/client.py", line 285, in _read_status raise RemoteDisconnected("Remote end closed connection without" urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/mnt/c/Users/guangyang/chatGptWechat/chatgpt-on-wechat/lib/itchat/components/login.py", line 296, in maintain_loop msgList, contactList = self.get_msg() File "/mnt/c/Users/guangyang/chatGptWechat/chatgpt-on-wechat/lib/itchat/components/login.py", line 383, in get_msg r = self.s.post(url, data=json.dumps(data), File "/usr/lib/python3/dist-packages/requests/sessions.py", line 581, in post return self.request('POST', url, data=data, json=json, **kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request resp = self.send(prep, **send_kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send r = adapter.send(request, **kwargs) File "/usr/lib/python3/dist-packages/requests/adapters.py", line 498, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))`
我是使用了Wechatty代理的,会不会和这个有原因呢?
python3 -V: Python 3.8.10
看上去像是网络问题,查下https://api.chatie.io/v0/hosties/puppet_padlocal_****,掉线前后地址有没有变化
看上去像是网络问题,查下https://api.chatie.io/v0/hosties/puppet_padlocal_****,掉线前后地址有没有变化
Thanks! 感觉是很好的debug方向,我照这个思路试一下。