Andrew McCracken
Claude
commited on
Commit
·
8f62d83
1
Parent(s):
c53e66f
Fix remaining f-string syntax errors
Browse files- Fix 'end' and 'error' data serialization
- Extract all dict literals outside f-strings
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
main.py
CHANGED
|
@@ -450,10 +450,12 @@ async def chat_stream(request: ChatRequest):
|
|
| 450 |
# Log interaction
|
| 451 |
log_interaction(session_id, request.message, len(full_response))
|
| 452 |
|
| 453 |
-
|
|
|
|
| 454 |
|
| 455 |
except Exception as e:
|
| 456 |
-
|
|
|
|
| 457 |
finally:
|
| 458 |
# Always return the model to the pool
|
| 459 |
if model is not None:
|
|
|
|
| 450 |
# Log interaction
|
| 451 |
log_interaction(session_id, request.message, len(full_response))
|
| 452 |
|
| 453 |
+
end_data = {'type': 'end'}
|
| 454 |
+
yield f"data: {json.dumps(end_data)}\n\n"
|
| 455 |
|
| 456 |
except Exception as e:
|
| 457 |
+
error_data = {'type': 'error', 'message': str(e)}
|
| 458 |
+
yield f"data: {json.dumps(error_data)}\n\n"
|
| 459 |
finally:
|
| 460 |
# Always return the model to the pool
|
| 461 |
if model is not None:
|