Update app.py
Browse files
app.py
CHANGED
@@ -512,16 +512,16 @@ def handsome_chat_completions():
|
|
512 |
openai_chunk["choices"][0]["delta"]["reasoning_content"] = None
|
513 |
yield f"data: {json.dumps(openai_chunk)}\n\n"
|
514 |
first_reasoning_chunk = False
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
|
521 |
if delta.get("content") is not None:
|
522 |
if not first_reasoning_chunk:
|
523 |
openai_chunk["choices"][0]["delta"]["content"] = "\n</think>\n"
|
524 |
-
openai_chunk["choices"][0]["delta"]["reasoning_content"] =
|
525 |
yield f"data: {json.dumps(openai_chunk)}\n\n"
|
526 |
first_reasoning_chunk = True
|
527 |
|
|
|
512 |
openai_chunk["choices"][0]["delta"]["reasoning_content"] = None
|
513 |
yield f"data: {json.dumps(openai_chunk)}\n\n"
|
514 |
first_reasoning_chunk = False
|
515 |
+
else:
|
516 |
+
openai_chunk["choices"][0]["delta"]["content"] = delta["reasoning_content"]
|
517 |
+
openai_chunk["choices"][0]["delta"]["reasoning_content"] = None
|
518 |
+
yield f"data: {json.dumps(openai_chunk)}\n\n"
|
519 |
+
reasoning_content_accumulated += delta["reasoning_content"]
|
520 |
|
521 |
if delta.get("content") is not None:
|
522 |
if not first_reasoning_chunk:
|
523 |
openai_chunk["choices"][0]["delta"]["content"] = "\n</think>\n"
|
524 |
+
openai_chunk["choices"][0]["delta"]["reasoning_content"] = None
|
525 |
yield f"data: {json.dumps(openai_chunk)}\n\n"
|
526 |
first_reasoning_chunk = True
|
527 |
|