ui
Browse files- __pycache__/app.cpython-311.pyc +0 -0
- app.py +8 -7
__pycache__/app.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
|
|
|
app.py
CHANGED
|
@@ -202,13 +202,14 @@ def chat():
|
|
| 202 |
for chunk in response_stream:
|
| 203 |
chunk_count += 1
|
| 204 |
logger.debug(f"Chunk {chunk_count} reçu")
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
if part.
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
|
|
|
| 212 |
|
| 213 |
logger.info(f"Streaming terminé, réponse complète: {len(full_response)} caractères")
|
| 214 |
|
|
|
|
| 202 |
for chunk in response_stream:
|
| 203 |
chunk_count += 1
|
| 204 |
logger.debug(f"Chunk {chunk_count} reçu")
|
| 205 |
+
if chunk.candidates and chunk.candidates[0].content:
|
| 206 |
+
for part in chunk.candidates[0].content.parts:
|
| 207 |
+
if part.text:
|
| 208 |
+
if part.thought and thinking_enabled:
|
| 209 |
+
thoughts += part.text
|
| 210 |
+
yield f"data: {json.dumps({'type': 'thought', 'content': part.text})}\n\n"
|
| 211 |
+
full_response += part.text
|
| 212 |
+
yield f"data: {json.dumps({'type': 'text', 'content': part.text})}\n\n"
|
| 213 |
|
| 214 |
logger.info(f"Streaming terminé, réponse complète: {len(full_response)} caractères")
|
| 215 |
|