From 46fc26db57ca3baccd024391e0afb66aa6abbd08 Mon Sep 17 00:00:00 2001 From: Clivia <132346501+Yanyutin753@users.noreply.github.com> Date: Sun, 29 Sep 2024 11:53:48 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=B3=20=E4=BF=AE=E5=A4=8Ddata:=E7=BB=93?= =?UTF-8?q?=E5=B0=BE=E4=BB=A3=E7=A0=81=E8=BE=93=E5=87=BA=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🥳 修复data:结尾代码输出出现异常问题 --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 753e0ae..750b0bb 100644 --- a/main.py +++ b/main.py @@ -327,9 +327,9 @@ scheduler.start() # PANDORA_UPLOAD_URL = 'files.pandoranext.com' -VERSION = '0.8.1' +VERSION = '0.8.2' # VERSION = 'test' -UPDATE_INFO = '👀 支持输出o1思考过程' +UPDATE_INFO = '🥳 修复data:结尾代码输出出现异常问题' # UPDATE_INFO = '【仅供临时测试使用】 ' with app.app_context(): @@ -2154,7 +2154,7 @@ def images_generations(): complete_data, buffer = buffer[:end_index], buffer[end_index:] # 解析 data 块 try: - data_json = json.loads(complete_data.replace('data: ', '')) + data_json = json.loads(re.sub(r'^data:\s*', '', complete_data).strip()) # print(f"data_json: {data_json}") message = data_json.get("message", {})