diff --git a/backend/src/module/parser/analyser/openai.py b/backend/src/module/parser/analyser/openai.py index c18d0f9d..9ac525a5 100644 --- a/backend/src/module/parser/analyser/openai.py +++ b/backend/src/module/parser/analyser/openai.py @@ -104,7 +104,7 @@ class OpenAIParser: if asdict: try: - result = json.loads(result) + result = json.loads(result[result.index("{"):result.rindex("}") + 1]) # find the first { and last } for better compatibility except json.JSONDecodeError: logger.warning(f"Cannot parse result {result} as python dict.")