diff --git a/pilot/scene/chat_db/auto_execute/out_parser.py b/pilot/scene/chat_db/auto_execute/out_parser.py index 136c74429..5ae3cc111 100644 --- a/pilot/scene/chat_db/auto_execute/out_parser.py +++ b/pilot/scene/chat_db/auto_execute/out_parser.py @@ -27,8 +27,11 @@ class DbChatOutputParser(BaseOutputParser): clean_str = super().parse_prompt_response(model_out_text) print("clean prompt response:", clean_str) response = json.loads(clean_str) - - sql, thoughts = response["sql"], response["thoughts"] + for key in sorted(response): + if key.strip() == 'sql': + sql =response[key] + if key.strip() == 'thoughts': + thoughts =response[key] return SqlAction(sql, thoughts) def parse_view_response(self, speak, data) -> str: diff --git a/pilot/scene/chat_execution/out_parser.py b/pilot/scene/chat_execution/out_parser.py index 565d54c5e..1124fa528 100644 --- a/pilot/scene/chat_execution/out_parser.py +++ b/pilot/scene/chat_execution/out_parser.py @@ -28,11 +28,13 @@ class PluginChatOutputParser(BaseOutputParser): except Exception as e: raise ValueError("model server out not fllow the prompt!") - command, thoughts, speak = ( - response["command"], - response["thoughts"], - response["speak"], - ) + for key in sorted(response): + if key.strip() == 'command': + command =response[key] + if key.strip() == 'thoughts': + thoughts =response[key] + if key.strip() == 'speak': + speak =response[key] return PluginAction(command, speak, thoughts) def parse_view_response(self, speak, data) -> str: