From 694e52fef2e39c7a7cba276a3969983537b073b4 Mon Sep 17 00:00:00 2001 From: zty Date: Tue, 29 Oct 2024 17:15:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=20mian=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 0f4d14a..5c3c5eb 100644 --- a/main.py +++ b/main.py @@ -330,7 +330,12 @@ async def extract_info( conf.CHAT_API, json={"model": conf.CHAT_MODEL, "prompt": prompt, "stream": False}, ) - info = json.loads((r.json()["response"])) + # info = json.loads((r.json()["response"])) + try: + # info = json.loads(r.json()["response"]) + info = r.json().get("response", {}) + except json.JSONDecodeError as e: + print(f"JSONDecodeError: {e}") return JSONResponse(content=info)