Skip to content

Commit

Permalink
🥳 修复data:结尾代码输出出现异常问题
Browse files Browse the repository at this point in the history
🥳 修复data:结尾代码输出出现异常问题
  • Loading branch information
Yanyutin753 committed Sep 29, 2024
1 parent de7d645 commit 46fc26d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,9 @@ def generate_gpts_payload(model, messages):
# 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():
Expand Down Expand Up @@ -2154,7 +2154,7 @@ def generate(proxy_api_prefix):
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", {})

Expand Down

0 comments on commit 46fc26d

Please sign in to comment.