Revert "[TMP] ai: Don't show reasoning for now."
Browse filesThis reverts commit 0e4af154cc92012b572926af6a05e16beebb344c.
jarvis.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
#
|
5 |
|
6 |
import asyncio
|
7 |
-
|
8 |
import docx
|
9 |
import gradio as gr
|
10 |
import httpx
|
@@ -219,9 +219,9 @@ async def fetch_response_stream_async(host, key, model, msgs, cfg, sid, stop_eve
|
|
219 |
if isinstance(j, dict) and j.get("choices"):
|
220 |
for ch in j["choices"]:
|
221 |
delta = ch.get("delta", {})
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
if "content" in delta and delta["content"] is not None and delta["content"] != "":
|
226 |
yield ("content", delta["content"])
|
227 |
except:
|
|
|
4 |
#
|
5 |
|
6 |
import asyncio
|
7 |
+
import codecs
|
8 |
import docx
|
9 |
import gradio as gr
|
10 |
import httpx
|
|
|
219 |
if isinstance(j, dict) and j.get("choices"):
|
220 |
for ch in j["choices"]:
|
221 |
delta = ch.get("delta", {})
|
222 |
+
if "reasoning" in delta and delta["reasoning"] is not None and delta["reasoning"] != "":
|
223 |
+
decoded_reasoning = delta["reasoning"].encode('utf-8').decode('unicode_escape')
|
224 |
+
yield ("reasoning", decoded_reasoning)
|
225 |
if "content" in delta and delta["content"] is not None and delta["content"] != "":
|
226 |
yield ("content", delta["content"])
|
227 |
except:
|