From 8c7be26661704ad26e46c4a4a2e8684af33b5dbc Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 27 Mar 2023 14:51:05 +0800 Subject: [PATCH] up --- predict.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/predict.py b/predict.py index 844e623..b017240 100644 --- a/predict.py +++ b/predict.py @@ -130,8 +130,10 @@ def predict(inputs, top_p, temperature, chatbot=[], history=[], system_prompt='' chunk = get_full_error(chunk, stream_response) error_msg = chunk.decode() if "reduce the length" in error_msg: - chatbot[-1] = (history[-1], "[Local Message] Input (or history) is too long, please reduce input or clear history by refleshing this page.") + chatbot[-1] = (chatbot[-1][0], "[Local Message] Input (or history) is too long, please reduce input or clear history by refleshing this page.") history = [] + elif "Incorrect API key" in error_msg: + chatbot[-1] = (chatbot[-1][0], "[Local Message] Incorrect API key provided.") yield chatbot, history, "Json解析不合常规,很可能是文本过长" + error_msg return