diff --git a/.DS_Store b/.DS_Store index 604f0e1..76e2ff1 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/webui_pages/utils.py b/webui_pages/utils.py index e57478c..6cca8d3 100644 --- a/webui_pages/utils.py +++ b/webui_pages/utils.py @@ -137,10 +137,13 @@ class ApiRequest: try: if chunk.startswith("data: "): data = json.loads(chunk[6:-2]) + pprint(data,depth=1) elif chunk.startswith(":"): # skip sse comment line continue else: data = json.loads(chunk) + pprint(data,depth=1) + #print(f"{data}") yield data except Exception as e: msg = f"接口返回json错误: ‘{chunk}’。错误信息是:{e}。" @@ -173,17 +176,21 @@ class ApiRequest: try: if chunk.startswith("data: "): data = json.loads(chunk[6:-2]) + print("ret_sync, data = json.loads(chunk[6:-2])") + pprint(data,depth=1) elif chunk.startswith(":"): # skip sse comment line continue else: + # print(f"{chunk}") data = json.loads(chunk) + print("ret_sync, data = json.loads(chunk)") + pprint(data,depth=1) yield data except Exception as e: msg = f"接口返回json错误: ‘{chunk}’。错误信息是:{e}。" logger.error(f'{e.__class__.__name__}: {msg}', exc_info=e if log_verbose else None) else: - # print(chunk, end="", flush=True) yield chunk except httpx.ConnectError as e: msg = f"无法连接API服务器,请确认 ‘api.py’ 已正常启动。({e})"