Git Product home page Git Product logo

Comments (18)

zhayujie avatar zhayujie commented on May 22, 2024 3

该问题已修复,重新拉取下代码即可解决。

问题原因 openai接口会偶发 出现访问速率超限的异常

openai.error.RateLimitError: The server had an error while processing your request. Sorry about that!

在保存到会话历史的时候,没有对这种异常数据做处理,导致后续对话都会失败。现在修复后,不会再影响后续对话。

@Ratten-fanger @ynzheng @Cy9nusG4rd3n

from chatgpt-on-wechat.

zhayujie avatar zhayujie commented on May 22, 2024

完整报错信息:

openai.error.RateLimitError: The server had an error while processing your request. Sorry about that! 

你的config.json是如何配置的, 在吗前面有个@, 是触发条件吗

from chatgpt-on-wechat.

Ratten-fanger avatar Ratten-fanger commented on May 22, 2024

{
"open_ai_api_key": "xx",
"single_chat_prefix": [""],
"single_chat_reply_prefix": "",
"group_chat_prefix": ["@bot"],
"group_name_white_list": "ALL_GROUP",
"image_create_prefix": ["画", "看", "找"],
"conversation_max_tokens": 2000,
"character_desc": "你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你乐于回答人们的任何问题"
}

from chatgpt-on-wechat.

Ratten-fanger avatar Ratten-fanger commented on May 22, 2024

@是我手动加的,即使不加也报错
[INFO][2023-02-06 16:00:15][open_ai_bot.py:20] - [OPEN_AI] query=你好
[ERROR][2023-02-06 16:00:15][wechat_channel.py:116] - can only concatenate str (not "NoneType") to str
Traceback (most recent call last):
File "/root/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 112, in _do_send
reply_text = super().build_reply_content(query, context).strip()
File "/root/chatgpt-on-wechat/channel/channel.py", line 31, in build_reply_content
return Bridge().fetch_reply_content(query, context)
File "/root/chatgpt-on-wechat/bridge/bridge.py", line 9, in fetch_reply_content
return bot_factory.create_bot("openAI").reply(query, context)
File "/root/chatgpt-on-wechat/bot/openai/open_ai_bot.py", line 26, in reply
new_query = Session.build_session_query(query, from_user_id)
File "/root/chatgpt-on-wechat/bot/openai/open_ai_bot.py", line 129, in build_session_query
prompt += "Q: " + conversation["question"] + "\n\n\nA: " + conversation["answer"] + "<|im_end|>\n"
TypeError: can only concatenate str (not "NoneType") to str

from chatgpt-on-wechat.

Ratten-fanger avatar Ratten-fanger commented on May 22, 2024

配置文件不变,重启后就正常了。所以我现在也不能复现了

from chatgpt-on-wechat.

zhayujie avatar zhayujie commented on May 22, 2024

[ERROR][2023-02-06 16:00:15][wechat_channel.py:116] - can only concatenate str (not "NoneType") to str

好的 我稍后看下

from chatgpt-on-wechat.

ynzheng avatar ynzheng commented on May 22, 2024

同样的问题

from chatgpt-on-wechat.

ynzheng avatar ynzheng commented on May 22, 2024

[INFO][2023-02-06 16:44:30][open_ai_bot.py:20] - [OPEN_AI] query=红包还给我[合十]
[ERROR][2023-02-06 16:44:32][open_ai_bot.py:51] - The server had an error while processing your request. Sorry about that!
Traceback (most recent call last):
File "/mnt/hkHomeData/home/ubuntu/github.com/zhayujie/chatgpt-on-wechat/bot/openai/open_ai_bot.py", line 39, in reply_text
response = openai.Completion.create(
File "/home/ubuntu/anaconda3/envs/py39/lib/python3.9/site-packages/openai/api_resources/completion.py", line 25, in create
return super().create(*args, **kwargs)
File "/home/ubuntu/anaconda3/envs/py39/lib/python3.9/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "/home/ubuntu/anaconda3/envs/py39/lib/python3.9/site-packages/openai/api_requestor.py", line 227, in request
resp, got_stream = self._interpret_response(result, stream)
File "/home/ubuntu/anaconda3/envs/py39/lib/python3.9/site-packages/openai/api_requestor.py", line 620, in _interpret_response
self._interpret_response_line(
File "/home/ubuntu/anaconda3/envs/py39/lib/python3.9/site-packages/openai/api_requestor.py", line 680, in _interpret_response_line
raise self.handle_error_response(
openai.error.RateLimitError: The server had an error while processing your request. Sorry about that!

from chatgpt-on-wechat.

Cy9nusG4rd3n avatar Cy9nusG4rd3n commented on May 22, 2024

同样的问题,感觉不太稳定

[INFO][2023-02-06 16:35:16][open_ai_bot.py:20] - [OPEN_AI] query=在吗
[ERROR][2023-02-06 16:35:20][open_ai_bot.py:51] - The server had an error while processing your request. Sorry about that!
Traceback (most recent call last):
File "/root/chatgpt-on-wechat/bot/openai/open_ai_bot.py", line 47, in reply_text
stop=["#"]
File "/usr/local/lib/python3.7/dist-packages/openai/api_resources/completion.py", line 25, in create
return super().create(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/openai/api_resources/abstract/engine_api_resource.py", line 160, in create
request_timeout=request_timeout,
File "/usr/local/lib/python3.7/dist-packages/openai/api_requestor.py", line 227, in request
resp, got_stream = self._interpret_response(result, stream)
File "/usr/local/lib/python3.7/dist-packages/openai/api_requestor.py", line 624, in _interpret_response
stream=False,
File "/usr/local/lib/python3.7/dist-packages/openai/api_requestor.py", line 681, in _interpret_response_line
rbody, rcode, resp.data, rheaders, stream_error=stream_error
openai.error.RateLimitError: The server had an error while processing your request. Sorry about that!
[ERROR][2023-02-06 16:35:20][wechat_channel.py:116] - object of type 'NoneType' has no len()
Traceback (most recent call last):
File "/root/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 112, in _do_send
reply_text = super().build_reply_content(query, context).strip()
File "/root/chatgpt-on-wechat/channel/channel.py", line 31, in build_reply_content
return Bridge().fetch_reply_content(query, context)
File "/root/chatgpt-on-wechat/bridge/bridge.py", line 9, in fetch_reply_content
return bot_factory.create_bot("openAI").reply(query, context)
File "/root/chatgpt-on-wechat/bot/openai/open_ai_bot.py", line 31, in reply
Session.save_session(query, reply_content, from_user_id)
File "/root/chatgpt-on-wechat/bot/openai/open_ai_bot.py", line 157, in save_session
Session.discard_exceed_conversation(user_session[user_id], max_tokens)
File "/root/chatgpt-on-wechat/bot/openai/open_ai_bot.py", line 167, in discard_exceed_conversation
count += len(history_conv["question"]) + len(history_conv["answer"])
TypeError: object of type 'NoneType' has no len()
image
image

from chatgpt-on-wechat.

xiaohua123456 avatar xiaohua123456 commented on May 22, 2024

该问题已修复,重新拉取下代码即可解决。

问题原因 openai接口会偶发 出现访问速率超限的异常

openai.error.RateLimitError: The server had an error while processing your request. Sorry about that!

在保存到会话历史的时候,没有对这种异常数据做处理,导致后续对话都会失败。现在修复后,不会再影响后续对话。

@Ratten-fanger @ynzheng @Cy9nusG4rd3n

重新更新代码后仍然出现了该问题。

from chatgpt-on-wechat.

tao19970417 avatar tao19970417 commented on May 22, 2024

[INFO][2023-02-06 17:30:08][open_ai_bot.py:20] - [OPEN_AI] query=流浪地球
[ERROR][2023-02-06 17:30:10][open_ai_bot.py:52] - You requested a model that is not compatible with this engine. Please contact us through our help center at help.openai.com for further questions.
Traceback (most recent call last):
File "C:\Users\aaa\PycharmProjects\chatgpt-on-wechat\bot\openai\open_ai_bot.py", line 40, in reply_text
response = openai.Completion.create(
File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_resources\completion.py", line 25, in create
return super().create(*args, **kwargs)
File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_requestor.py", line 227, in request
resp, got_stream = self._interpret_response(result, stream)
File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_requestor.py", line 620, in _interpret_response
self._interpret_response_line(
File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_requestor.py", line 680, in _interpret_response_line
raise self.handle_error_response(
openai.error.InvalidRequestError: You requested a model that is not compatible with this engine. Please contact us through our help center at help.openai.com for further questions.
[ERROR][2023-02-06 17:30:10][wechat_channel.py:116] - 'NoneType' object has no attribute 'strip'
Traceback (most recent call last):
File "C:\Users\aaa\PycharmProjects\chatgpt-on-wechat\channel\wechat\wechat_channel.py", line 112, in _do_send
reply_text = super().build_reply_content(query, context).strip()
AttributeError: 'NoneType' object has no attribute 'strip'

最新代码仍然出现了问题,麻烦看一下呢 @zhayujie

from chatgpt-on-wechat.

Ratten-fanger avatar Ratten-fanger commented on May 22, 2024

拉取最新代码后,会偶发openai.error.RateLimitError: The server had an error while processing your request. Sorry about that!
,但似乎不会影响后续问题了,十分感谢

from chatgpt-on-wechat.

zhayujie avatar zhayujie commented on May 22, 2024

[INFO][2023-02-06 17:30:08][open_ai_bot.py:20] - [OPEN_AI] query=流浪地球 [ERROR][2023-02-06 17:30:10][open_ai_bot.py:52] - You requested a model that is not compatible with this engine. Please contact us through our help center at help.openai.com for further questions. Traceback (most recent call last): File "C:\Users\aaa\PycharmProjects\chatgpt-on-wechat\bot\openai\open_ai_bot.py", line 40, in reply_text response = openai.Completion.create( File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_resources\completion.py", line 25, in create return super().create(*args, **kwargs) File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 153, in create response, _, api_key = requestor.request( File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_requestor.py", line 227, in request resp, got_stream = self._interpret_response(result, stream) File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_requestor.py", line 620, in _interpret_response self._interpret_response_line( File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_requestor.py", line 680, in _interpret_response_line raise self.handle_error_response( openai.error.InvalidRequestError: You requested a model that is not compatible with this engine. Please contact us through our help center at help.openai.com for further questions. [ERROR][2023-02-06 17:30:10][wechat_channel.py:116] - 'NoneType' object has no attribute 'strip' Traceback (most recent call last): File "C:\Users\aaa\PycharmProjects\chatgpt-on-wechat\channel\wechat\wechat_channel.py", line 112, in _do_send reply_text = super().build_reply_content(query, context).strip() AttributeError: 'NoneType' object has no attribute 'strip'

最新代码仍然出现了问题,麻烦看一下呢 @zhayujie

这里报错的是

You requested a model that is not compatible with this engine. Please contact us through our help center at help.openai.com for further questions.

你有修改使用的模型嘛

from chatgpt-on-wechat.

tao19970417 avatar tao19970417 commented on May 22, 2024

[INFO][2023-02-06 17:30:08][open_ai_bot.py:20] - [OPEN_AI] query=流浪地球 [ERROR][2023-02-06 17:30:10][open_ai_bot.py:52] - You requested a model that is not compatible with this engine. Please contact us through our help center at help.openai.com for further questions. Traceback (most recent call last): File "C:\Users\aaa\PycharmProjects\chatgpt-on-wechat\bot\openai\open_ai_bot.py", line 40, in reply_text response = openai.Completion.create( File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_resources\completion.py", line 25, in create return super().create(*args, **kwargs) File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 153, in create response, _, api_key = requestor.request( File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_requestor.py", line 227, in request resp, got_stream = self._interpret_response(result, stream) File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_requestor.py", line 620, in _interpret_response self._interpret_response_line( File "C:\Users\aaa\AppData\Local\Programs\Python\Python38\lib\site-packages\openai\api_requestor.py", line 680, in _interpret_response_line raise self.handle_error_response( openai.error.InvalidRequestError: You requested a model that is not compatible with this engine. Please contact us through our help center at help.openai.com for further questions. [ERROR][2023-02-06 17:30:10][wechat_channel.py:116] - 'NoneType' object has no attribute 'strip' Traceback (most recent call last): File "C:\Users\aaa\PycharmProjects\chatgpt-on-wechat\channel\wechat\wechat_channel.py", line 112, in _do_send reply_text = super().build_reply_content(query, context).strip() AttributeError: 'NoneType' object has no attribute 'strip'
最新代码仍然出现了问题,麻烦看一下呢 @zhayujie

这里报错的是

You requested a model that is not compatible with this engine. Please contact us through our help center at help.openai.com for further questions.

你有修改使用的模型嘛

我没有改过诶,模型哪里可以修改吗?

from chatgpt-on-wechat.

zhayujie avatar zhayujie commented on May 22, 2024

重新更新代码后仍然出现了该问题。

这个报错是 openai 做的访问速率限制,还是有可能出现的,但是应该不会影响后续对话了吧?

from chatgpt-on-wechat.

ninirobot avatar ninirobot commented on May 22, 2024

大佬,我也出现了openai.error.RateLimitError: The server had an error while processing your request. Sorry about that!的问题,这个能在哪里修补一下提高这个速率上限吗?后续对话貌似不影响,好像重新问几次也能继续对话。

from chatgpt-on-wechat.

zhayujie avatar zhayujie commented on May 22, 2024

最新的提交中对于 openai.error.RateLimitError 异常进行了捕获,默认sleep 5s后重试一次,如果仍然报错则回复兜底话术。白天观察下报错情况,能否重试成功。


P.S. openai后台应该是根据当时 整体的负载压力来进行限流的,我在晚上较快频率提问了很多次也没能复现这个问题。

from chatgpt-on-wechat.

xiaohua123456 avatar xiaohua123456 commented on May 22, 2024

重新更新代码后仍然出现了该问题。

这个报错是 openai 做的访问速率限制,还是有可能出现的,但是应该不会影响后续对话了吧?

已经不影响后续对话了。

from chatgpt-on-wechat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.