Previously, any unhandled exception during query processing caused the
entire backend server to exit via sys.exit(1), making the frontend show
'System offline. Deploy backend first.' until the container was restarted.
Also, is_generating was never reset to False on exception, permanently
blocking all subsequent queries with 429 responses.
- Replace sys.exit(1) with a proper HTTP 500 error response
- Move is_generating = False to the finally block so it always resets
Fixes#382