Update app.py
Browse files
app.py
CHANGED
|
@@ -623,14 +623,14 @@ async def _stream_gen(
|
|
| 623 |
):
|
| 624 |
for kind, text in parser.feed(token):
|
| 625 |
if kind == "reasoning":
|
| 626 |
-
yield _chunk({"
|
| 627 |
else:
|
| 628 |
yield _chunk({"content": text})
|
| 629 |
|
| 630 |
# ── flush parser buffer ───────────────────────
|
| 631 |
for kind, text in parser.flush():
|
| 632 |
if kind == "reasoning":
|
| 633 |
-
yield _chunk({"
|
| 634 |
else:
|
| 635 |
yield _chunk({"content": text})
|
| 636 |
|
|
@@ -680,9 +680,9 @@ async def _complete(
|
|
| 680 |
"content": "".join(content),
|
| 681 |
}
|
| 682 |
if reasoning:
|
| 683 |
-
msg["
|
| 684 |
|
| 685 |
-
total_chars = len(msg["content"]) + len(msg.get("
|
| 686 |
|
| 687 |
return {
|
| 688 |
"id": _cid(),
|
|
|
|
| 623 |
):
|
| 624 |
for kind, text in parser.feed(token):
|
| 625 |
if kind == "reasoning":
|
| 626 |
+
yield _chunk({"reasoning": text})
|
| 627 |
else:
|
| 628 |
yield _chunk({"content": text})
|
| 629 |
|
| 630 |
# ── flush parser buffer ───────────────────────
|
| 631 |
for kind, text in parser.flush():
|
| 632 |
if kind == "reasoning":
|
| 633 |
+
yield _chunk({"reasoning": text})
|
| 634 |
else:
|
| 635 |
yield _chunk({"content": text})
|
| 636 |
|
|
|
|
| 680 |
"content": "".join(content),
|
| 681 |
}
|
| 682 |
if reasoning:
|
| 683 |
+
msg["reasoning"] = "".join(reasoning)
|
| 684 |
|
| 685 |
+
total_chars = len(msg["content"]) + len(msg.get("reasoning", ""))
|
| 686 |
|
| 687 |
return {
|
| 688 |
"id": _cid(),
|