Spaces:
Sleeping
Sleeping
Fix syntax error: replace multi-line f-strings with variables in stream_anthropic
Browse files
app.py
CHANGED
|
@@ -282,14 +282,15 @@ async def stream_anthropic(ollama_stream, original_model: str):
|
|
| 282 |
|
| 283 |
if content:
|
| 284 |
# Send text_delta
|
| 285 |
-
|
| 286 |
'type': 'content_block_delta',
|
| 287 |
'index': 0,
|
| 288 |
'delta': {
|
| 289 |
'type': 'text_delta',
|
| 290 |
'text': content
|
| 291 |
}
|
| 292 |
-
}
|
|
|
|
| 293 |
except json.JSONDecodeError:
|
| 294 |
continue
|
| 295 |
|
|
|
|
| 282 |
|
| 283 |
if content:
|
| 284 |
# Send text_delta
|
| 285 |
+
content_block_delta_data = {
|
| 286 |
'type': 'content_block_delta',
|
| 287 |
'index': 0,
|
| 288 |
'delta': {
|
| 289 |
'type': 'text_delta',
|
| 290 |
'text': content
|
| 291 |
}
|
| 292 |
+
}
|
| 293 |
+
yield f"data: {json.dumps(content_block_delta_data)}\n\n"
|
| 294 |
except json.JSONDecodeError:
|
| 295 |
continue
|
| 296 |
|