AnatoliiG commited on
Commit ·
29c8255
1
Parent(s): 64745df
Update routes.py
Browse files- src/api/routes.py +15 -15
src/api/routes.py
CHANGED
|
@@ -49,22 +49,22 @@ async def chat_completions(request: Request):
|
|
| 49 |
# stop early if requested (e.g. client disconnected)
|
| 50 |
if stop_event.is_set():
|
| 51 |
break
|
| 52 |
-
chunk_count += 1
|
| 53 |
-
now = time.time()
|
| 54 |
loop.call_soon_threadsafe(q.put_nowait, chunk)
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
# финальный лог
|
| 60 |
-
loop.call_soon_threadsafe(
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
)
|
| 68 |
except Exception as e:
|
| 69 |
# Pass exception to the async side so we can surface an error or terminate cleanly
|
| 70 |
loop.call_soon_threadsafe(q.put_nowait, {"__error": str(e)})
|
|
|
|
| 49 |
# stop early if requested (e.g. client disconnected)
|
| 50 |
if stop_event.is_set():
|
| 51 |
break
|
| 52 |
+
# chunk_count += 1
|
| 53 |
+
# now = time.time()
|
| 54 |
loop.call_soon_threadsafe(q.put_nowait, chunk)
|
| 55 |
+
# loop.call_soon_threadsafe(
|
| 56 |
+
# q.put_nowait,
|
| 57 |
+
# {"__chunk": chunk, "ts": now, "count": chunk_count},
|
| 58 |
+
# )
|
| 59 |
+
# # финальный лог
|
| 60 |
+
# loop.call_soon_threadsafe(
|
| 61 |
+
# q.put_nowait,
|
| 62 |
+
# {
|
| 63 |
+
# "__done": True,
|
| 64 |
+
# "duration": time.time() - start,
|
| 65 |
+
# "chunks": chunk_count,
|
| 66 |
+
# },
|
| 67 |
+
# )
|
| 68 |
except Exception as e:
|
| 69 |
# Pass exception to the async side so we can surface an error or terminate cleanly
|
| 70 |
loop.call_soon_threadsafe(q.put_nowait, {"__error": str(e)})
|