From 30ecd9f0055ec8640282af4bee292ed76e30b03b Mon Sep 17 00:00:00 2001 From: yhjun1026 <460342015@qq.com> Date: Tue, 13 Jun 2023 21:03:21 +0800 Subject: [PATCH] =?UTF-8?q?fix=20plugin=20mode=20bug=EF=BC=9BOptimize=20th?= =?UTF-8?q?e=20parsing=20logic=20for=20model=20response?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pilot/scene/chat_execution/out_parser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pilot/scene/chat_execution/out_parser.py b/pilot/scene/chat_execution/out_parser.py index 6f67bde38..44f203d1e 100644 --- a/pilot/scene/chat_execution/out_parser.py +++ b/pilot/scene/chat_execution/out_parser.py @@ -21,6 +21,8 @@ class PluginChatOutputParser(BaseOutputParser): def parse_prompt_response(self, model_out_text) -> T: clean_json_str = super().parse_prompt_response(model_out_text) print(clean_json_str) + if not clean_json_str: + raise ValueError("model server response not have json!") try: response = json.loads(clean_json_str) except Exception as e: