From 4ac2584db5dde11a1af8743ec053fae3d62088c5 Mon Sep 17 00:00:00 2001 From: smstone2006 <22697471@qq.com> Date: Mon, 28 Apr 2025 15:01:40 +0800 Subject: [PATCH] =?UTF-8?q?we=20shouldn't=20get=20json=20object=20by=20usi?= =?UTF-8?q?ng=20string=20method,=20if=20the=20parameter=20doesn't=20meet?= =?UTF-8?q?=20the=20rules=EF=BC=8Cit=20will=20throw=20a=20exception.=20for?= =?UTF-8?q?=20example=20:=20#255.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lpm_kernel/L1/topics_generator.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lpm_kernel/L1/topics_generator.py b/lpm_kernel/L1/topics_generator.py index 978ebf7b..19e756e8 100644 --- a/lpm_kernel/L1/topics_generator.py +++ b/lpm_kernel/L1/topics_generator.py @@ -677,12 +677,8 @@ def __parse_response(self, content: str, key1: str, key2: str) -> tuple: Returns: A tuple containing the values for the two keys """ - spl = key1 + '":' - b = '{"' + spl + "".join(content.split(spl)[1:]) - c = b.split("}")[0] + "}" - res_dict = json.loads(c) - - return res_dict[key1], res_dict[key2] + data = json.loads(content) + return data[key1], data[key2] def __build_embedding_chunks(self, notes_list: List[Note]) -> tuple: