From 90d96b77e63f751dae7f3ffdd3f99d67cf6bb104 Mon Sep 17 00:00:00 2001 From: binary-husky Date: Thu, 29 Feb 2024 00:36:06 +0800 Subject: [PATCH] handle qianfan chat error --- request_llms/bridge_qianfan.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/request_llms/bridge_qianfan.py b/request_llms/bridge_qianfan.py index 0f02457..ab3235c 100644 --- a/request_llms/bridge_qianfan.py +++ b/request_llms/bridge_qianfan.py @@ -160,3 +160,8 @@ def predict(inputs, llm_kwargs, plugin_kwargs, chatbot, history=[], system_promp chatbot[-1] = (chatbot[-1][0], "[Local Message] Reduce the length. 本次输入过长, 或历史数据过长. 历史缓存数据已部分释放, 您可以请再次尝试. (若再次失败则更可能是因为输入过长.)") yield from update_ui(chatbot=chatbot, history=history, msg="异常") # 刷新界面 return + except RuntimeError as e: + tb_str = '```\n' + trimmed_format_exc() + '```' + chatbot[-1] = (chatbot[-1][0], tb_str) + yield from update_ui(chatbot=chatbot, history=history, msg="异常") # 刷新界面 + return \ No newline at end of file