kuro223 commited on
Commit
bd93f15
·
1 Parent(s): 19c5a64
Files changed (2) hide show
  1. __pycache__/app.cpython-311.pyc +0 -0
  2. 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
- for part in chunk.candidates[0].content.parts:
206
- if part.text:
207
- if part.thought and thinking_enabled:
208
- thoughts += part.text
209
- yield f"data: {json.dumps({'type': 'thought', 'content': part.text})}\n\n"
210
- full_response += part.text
211
- yield f"data: {json.dumps({'type': 'text', 'content': part.text})}\n\n"
 
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