ai: Decode the reasoning process.
Browse files
jarvis.py
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
#
|
5 |
|
6 |
import asyncio
|
|
|
7 |
import docx
|
8 |
import gradio as gr
|
9 |
import httpx
|
@@ -221,7 +222,8 @@ async def fetch_response_stream_async(host, key, model, msgs, cfg, sid, stop_eve
|
|
221 |
for ch in j["choices"]:
|
222 |
delta = ch.get("delta", {})
|
223 |
if "reasoning" in delta and delta["reasoning"] is not None and delta["reasoning"] != "":
|
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
|
|
|
222 |
for ch in j["choices"]:
|
223 |
delta = ch.get("delta", {})
|
224 |
if "reasoning" in delta and delta["reasoning"] is not None and delta["reasoning"] != "":
|
225 |
+
decoded_reasoning = delta["reasoning"].encode('utf-8').decode('unicode_escape')
|
226 |
+
yield ("reasoning", decoded_reasoning)
|
227 |
if "content" in delta and delta["content"] is not None and delta["content"] != "":
|
228 |
yield ("content", delta["content"])
|
229 |
except:
|