From 6cd2d80dfda20fcf5f9c1f0789ccf4db109a3f91 Mon Sep 17 00:00:00 2001 From: Menghuan1918 Date: Mon, 1 Jul 2024 20:35:49 +0800 Subject: [PATCH] Bug fix: Some non-standard forms of error return are not caught (#1877) --- request_llms/oai_std_model_template.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/request_llms/oai_std_model_template.py b/request_llms/oai_std_model_template.py index 648dbe41c..1d649af96 100644 --- a/request_llms/oai_std_model_template.py +++ b/request_llms/oai_std_model_template.py @@ -44,7 +44,8 @@ def decode_chunk(chunk): try: chunk = json.loads(chunk[6:]) except: - finish_reason = "JSON_ERROR" + respose = "API_ERROR" + finish_reason = chunk # 错误处理部分 if "error" in chunk: respose = "API_ERROR"