Update app.py
Browse files
app.py
CHANGED
@@ -421,13 +421,13 @@ def handsome_chat_completions():
|
|
421 |
if first_reasoning_chunk:
|
422 |
reasoning_chunk = "```Thinking\n" + reasoning_chunk
|
423 |
first_reasoning_chunk = False
|
424 |
-
yield f"data: {json.dumps({'choices': [{'delta': {'content': reasoning_chunk}, 'index': 0}]})}\n"
|
425 |
|
426 |
if delta.get("content") is not None:
|
427 |
if not first_reasoning_chunk:
|
428 |
-
yield f"data: {json.dumps({'choices': [{'delta': {'content': '\n```'}, 'index': 0}]})}\n"
|
429 |
first_reasoning_chunk = True
|
430 |
-
yield f"data: {json.dumps({'choices': [{'delta': {'content': delta["content"]}, 'index': 0}]})}\n"
|
431 |
|
432 |
except (KeyError, ValueError, json.JSONDecodeError) as e:
|
433 |
logging.error(f"解析流式响应单行 JSON 失败: {e}, 行内容: {line}")
|
|
|
421 |
if first_reasoning_chunk:
|
422 |
reasoning_chunk = "```Thinking\n" + reasoning_chunk
|
423 |
first_reasoning_chunk = False
|
424 |
+
yield f"data: {json.dumps({'choices': [{'delta': {'content': reasoning_chunk}, 'index': 0}]})}\n\n"
|
425 |
|
426 |
if delta.get("content") is not None:
|
427 |
if not first_reasoning_chunk:
|
428 |
+
yield f"data: {json.dumps({'choices': [{'delta': {'content': '\n```'}, 'index': 0}]})}\n\n"
|
429 |
first_reasoning_chunk = True
|
430 |
+
yield f"data: {json.dumps({'choices': [{'delta': {'content': delta["content"]}, 'index': 0}]})}\n\n"
|
431 |
|
432 |
except (KeyError, ValueError, json.JSONDecodeError) as e:
|
433 |
logging.error(f"解析流式响应单行 JSON 失败: {e}, 行内容: {line}")
|