- lm_studio_fn: use urlparse to extract port from server_address so that
addresses with an http:// prefix (e.g. http://127.0.0.1:1234, as
documented in README) no longer break the Docker URL construction.
Previously split(":")[1] returned "//127.0.0.1" instead of the port
number, producing a malformed URL.
Also fix the non-Docker path to avoid prepending http:// when the address
already includes a scheme.
- api.py: pass the computed port variable to uvicorn.run() instead of the
hardcoded literal 7777, so that BACKEND_PORT environment variable is
actually honoured when starting the server directly.
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