fix: disabled STT also covers live finish; clarify model cache location

This commit is contained in:
Alex committed 2026-09-15 19:28:19 +01:00
1 parent 94255863d1
commit 02f2fa198a
3 files changed
+18 -1

No files matched your search

@@ -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:
+2
View File
@@ -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"):
+15
View File
@@ -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)