diff --git a/voice-to-mermaid/README.md b/voice-to-mermaid/README.md index 8203703..2df67be 100644 --- a/voice-to-mermaid/README.md +++ b/voice-to-mermaid/README.md @@ -78,7 +78,7 @@ It is volume-mounted in Docker, so changes take effect on restart without rebuil | `ollama.default_model` | `qwen3:8b` | Ollama model for diagram generation | | `ollama.model_filter` | _(list)_ | Model name prefixes shown in the UI picker | | `openai.model` | `gpt-4o-mini` | OpenAI-compatible model name | -| `whisper.enabled` | `false` | Set `true` after installing `requirements.stt.txt`; graceful no-op if import fails | +| `whisper.enabled` | `true` | STT enabled by default (deps installed in Docker image); graceful no-op if import fails | | `whisper.model` | `medium.en` | Whisper model size | | `whisper.device` | `auto` | `auto` / `cpu` / `cuda` | | `paths.prompt` | `prompts/mermaid.txt` | Path to LLM prompt template | diff --git a/voice-to-mermaid/backend/Dockerfile b/voice-to-mermaid/backend/Dockerfile index 09184ca..bcd44a3 100644 --- a/voice-to-mermaid/backend/Dockerfile +++ b/voice-to-mermaid/backend/Dockerfile @@ -4,8 +4,8 @@ FROM python:3.12-slim RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/* WORKDIR /app -COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt +COPY requirements.txt requirements.stt.txt ./ +RUN pip install --no-cache-dir -r requirements.stt.txt COPY . . diff --git a/voice-to-mermaid/backend/config.yaml b/voice-to-mermaid/backend/config.yaml index 8a85a24..936fb6d 100644 --- a/voice-to-mermaid/backend/config.yaml +++ b/voice-to-mermaid/backend/config.yaml @@ -18,9 +18,9 @@ openai: model: "gpt-4o-mini" whisper: - # Set true only after installing requirements.stt.txt (or adding it to Dockerfile). + # Enabled: requirements.stt.txt is now installed in the Dockerfile. # If import fails, _stt_available stays False and /v1/config returns stt_enabled: false — no crash. - enabled: false + enabled: true model: "medium.en" language: "en" device: "auto" # "auto", "cuda", "cpu" — maps to WhisperLiveKitConfig backend diff --git a/voice-to-mermaid/backend/main.py b/voice-to-mermaid/backend/main.py index 8e11236..8af551e 100644 --- a/voice-to-mermaid/backend/main.py +++ b/voice-to-mermaid/backend/main.py @@ -333,7 +333,7 @@ async def health(): @app.get("/v1/config") async def config(): global _ollama_models_cache - if _ollama_models_cache is None: + if not _ollama_models_cache: _ollama_models_cache = await _fetch_ollama_models() return { "ollama_url": OLLAMA_URL, @@ -357,9 +357,6 @@ async def refresh_models(): @app.websocket("/ws/mermaid") async def ws_mermaid(websocket: WebSocket): - if _stt_available: - from whisperlivekit import AudioProcessor - await websocket.accept() llm_mode: str = "ollama" @@ -456,6 +453,7 @@ async def _consume_results(results_generator, line_count_ref: list[int]) -> None line_count_ref = [0] if _stt_available: + from whisperlivekit import AudioProcessor audio_processor = AudioProcessor(transcription_engine=_transcription_engine) results_generator = await audio_processor.create_tasks() results_task = asyncio.create_task(_consume_results(results_generator, line_count_ref))