Spaces:
Paused
Paused
Your Name
commited on
Commit
•
9d2bc1f
1
Parent(s):
f956dcd
修复错误提醒
Browse files
request_llm/bridge_chatgpt.py
CHANGED
@@ -195,10 +195,13 @@ def predict(inputs, llm_kwargs, plugin_kwargs, chatbot, history=[], system_promp
|
|
195 |
traceback.print_exc()
|
196 |
yield from update_ui(chatbot=chatbot, history=history, msg="Json解析不合常规") # 刷新界面
|
197 |
chunk = get_full_error(chunk, stream_response)
|
|
|
198 |
error_msg = chunk_decoded
|
199 |
if "reduce the length" in error_msg:
|
200 |
chatbot[-1] = (chatbot[-1][0], "[Local Message] Reduce the length. 本次输入过长,或历史数据过长. 历史缓存数据现已释放,您可以请再次尝试.")
|
201 |
history = [] # 清除历史
|
|
|
|
|
202 |
elif "Incorrect API key" in error_msg:
|
203 |
chatbot[-1] = (chatbot[-1][0], "[Local Message] Incorrect API key. OpenAI以提供了不正确的API_KEY为由,拒绝服务.")
|
204 |
elif "exceeded your current quota" in error_msg:
|
|
|
195 |
traceback.print_exc()
|
196 |
yield from update_ui(chatbot=chatbot, history=history, msg="Json解析不合常规") # 刷新界面
|
197 |
chunk = get_full_error(chunk, stream_response)
|
198 |
+
chunk_decoded = chunk.decode()
|
199 |
error_msg = chunk_decoded
|
200 |
if "reduce the length" in error_msg:
|
201 |
chatbot[-1] = (chatbot[-1][0], "[Local Message] Reduce the length. 本次输入过长,或历史数据过长. 历史缓存数据现已释放,您可以请再次尝试.")
|
202 |
history = [] # 清除历史
|
203 |
+
elif "does not exist" in error_msg:
|
204 |
+
chatbot[-1] = (chatbot[-1][0], f"[Local Message] Model {llm_kwargs['llm_model']} does not exist. 模型不存在,或者您没有获得体验资格.")
|
205 |
elif "Incorrect API key" in error_msg:
|
206 |
chatbot[-1] = (chatbot[-1][0], "[Local Message] Incorrect API key. OpenAI以提供了不正确的API_KEY为由,拒绝服务.")
|
207 |
elif "exceeded your current quota" in error_msg:
|