manateelazycat / mind-wave

Emacs AI plugin based on ChatGPT API
GNU General Public License v3.0
158 stars 26 forks source link

openai.error.AuthenticationError: <empty message> #36

Open lemyx opened 1 year ago

lemyx commented 1 year ago

向 ChatGPT 发去问题,得到报错:

Wrote /home/mawen/chat/0005.chat
Wait ChatGPT...
[Mind-Wave] Traceback (most recent call last):
  File "/home/mawen/.emacs.d/site-lisp/mind-wave/mind_wave.py", line 38, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/mawen/.emacs.d/site-lisp/mind-wave/mind_wave.py", line 130, in send_stream_request
    response = openai.ChatCompletion.create(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mawen/.local/lib/python3.11/site-packages/openai/api_resources/chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mawen/.local/lib/python3.11/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
                           ^^^^^^^^^^^^^^^^^^
  File "/home/mawen/.local/lib/python3.11/site-packages/openai/api_requestor.py", line 230, in request
    resp, got_stream = self._interpret_response(result, stream)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mawen/.local/lib/python3.11/site-packages/openai/api_requestor.py", line 624, in _interpret_response
    self._interpret_response_line(
  File "/home/mawen/.local/lib/python3.11/site-packages/openai/api_requestor.py", line 687, in _interpret_response_line
    raise self.handle_error_response(
openai.error.AuthenticationError: <empty message>

这个 sk- 开头的 API key 在 Chrome 的 ChatHub 插件是能用的,应该能排除 key 过期的问题

manateelazycat commented 1 year ago

我刚刚试验了自己的,可以用。你的账号被封锁了吗?

manateelazycat commented 1 year ago

我刚刚试验了自己的,可以用。你的账号被封锁了吗?

lemyx commented 1 year ago

谢谢懒猫,我再申请一下新的key试试吧。

lemyx commented 1 year ago

Wait ChatGPT...

Wrote /home/name/chatgpt/conversation/0003.chat
Wait ChatGPT...
[Mind-Wave] Traceback (most recent call last):
  File "/home/name/.emacs.d/site-lisp/mind-wave/mind_wave.py", line 38, in wrapper
    return func(*args, **kwargs)
  File "/home/name/.emacs.d/site-lisp/mind-wave/mind_wave.py", line 130, in send_stream_request
    response = openai.ChatCompletion.create(
  File "/home/name/.local/lib/python3.10/site-packages/openai/api_resources/chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
  File "/home/name/.local/lib/python3.10/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
  File "/home/name/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 216, in request
    result = self.request_raw(
  File "/home/name/.local/lib/python3.10/site-packages/openai/api_requestor.py", line 516, in request_raw
    result = _thread_context.session.request(
  File "/home/name/.local/lib/python3.10/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/name/.local/lib/python3.10/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/home/name/.local/lib/python3.10/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/home/name/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/home/name/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.10/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1323, in _send_request
    self.putheader(hdr, value)
  File "/usr/lib/python3.10/http/client.py", line 1255, in putheader
    values[i] = one_value.encode(’latin-1’)
UnicodeEncodeError: ’latin-1’ codec can’t encode characters in position 58-59: ordinal not in range(256)

换了个新 key,报了另外的错误 是在 Ubuntu 上测试的

manateelazycat commented 1 year ago

pip install --upgrade openai requests

升级一下看看?

我没有遇到过这个编码错误。 ;)