diff --git a/docs/content/Deploying/Development-Environment.mdx b/docs/content/Deploying/Development-Environment.mdx index f2cfe269..6c01879f 100644 --- a/docs/content/Deploying/Development-Environment.mdx +++ b/docs/content/Deploying/Development-Environment.mdx @@ -78,7 +78,7 @@ To run the DocsGPT backend locally, you'll need to set up a Python environment a 3. **Embedding Model (no action needed):** - The embedding model is downloaded automatically the first time you ingest a document, and cached under `models/` in the repository root for subsequent runs. Set `EMBEDDINGS_CACHE_DIR` to use another directory. + The embedding model is downloaded automatically the first time you ingest a document, and cached for subsequent runs under `models/` in the data home: the repository root, unless `DOCSGPT_HOME` points elsewhere. Set `EMBEDDINGS_CACHE_DIR` to use another directory. For an offline or air-gapped machine, fetch it ahead of time instead: diff --git a/docsgpt/api/user/attachments/routes.py b/docsgpt/api/user/attachments/routes.py index 44cb8a7e..7db27b99 100644 --- a/docsgpt/api/user/attachments/routes.py +++ b/docsgpt/api/user/attachments/routes.py @@ -688,6 +688,8 @@ class LiveSpeechToTextFinish(Resource): jsonify({"success": False, "message": "Authentication required"}), 401, ) + if not STTCreator.is_enabled(settings.STT_PROVIDER): + return _feature_disabled(_STT_DISABLED_MESSAGE) redis_client = _require_live_stt_redis() if hasattr(redis_client, "status_code"): diff --git a/tests/api/user/attachments/test_routes.py b/tests/api/user/attachments/test_routes.py index 8f2f2201..e7979a6d 100644 --- a/tests/api/user/attachments/test_routes.py +++ b/tests/api/user/attachments/test_routes.py @@ -1929,6 +1929,21 @@ class TestSpeechToTextDisabled: assert _get_response_json(response) == self.DISABLED mock_create_stt.assert_not_called() + def test_live_stt_finish_returns_404_without_touching_redis(self, flask_app): + from docsgpt.api.user.attachments import routes + + app = Flask(__name__) + with patch.object(routes.settings, "STT_PROVIDER", "none"), patch.object( + routes, "_require_live_stt_redis" + ) as require_redis, app.test_request_context( + "/api/stt/live/finish", method="POST", json={"session_id": "abc"} + ): + request.decoded_token = {"sub": "test_user"} + response = routes.LiveSpeechToTextFinish().post() + assert _get_response_status(response) == 404 + assert _get_response_json(response) == self.DISABLED + require_redis.assert_not_called() + # ===================================================================== # Coverage gap tests (lines 136, 256, 330, 337, 443, 457, 560, 590)