Commit graph

6 commits

Author SHA1 Message Date
Bossiara13
cdd331af35 fix: Python startup no longer silent on first run
Some checks failed
Python CI / pytest (ubuntu-latest) (push) Failing after 27s
Python CI / ruff (push) Failing after 5s
Python CI / pytest (windows-latest) (push) Has been cancelled
ROOT CAUSE

User reported the Python edition showed "только пустой терминал" — empty
terminal — when launched. Three compounding issues:

1. `tts.py` called `torch.hub.load(...)` at MODULE IMPORT time. On first
   use this downloads a 60MB Silero model with no progress output beyond
   one "Using cache found in..." line. With no prior banner the user
   couldn't tell if it crashed or was loading.
2. main.py's startup banner (`print("=" * 60)...J.A.R.V.I.S. v...`)
   appeared AFTER all the heavy imports. So even when nothing was wrong,
   visible feedback was delayed by 10-60 seconds.
3. If `pip install -r requirements.txt` failed for any package
   (`simpleaudio` notoriously needs MSVC to build), `import simpleaudio`
   crashed the whole process with a raw ModuleNotFoundError.

FIXES

- `tts.py`: Silero model load moved into `_ensure_model()` called lazily
  from `synthesize()`. First synth pays the load cost (with a one-line
  progress hint) — everything before that is visible immediately.
- `main.py`: print "J.A.R.V.I.S. loading..." banner BEFORE any heavy
  imports. User sees the terminal is alive within ~100ms.
- `main.py`: scan required deps before importing them; if any are
  missing, print "Run: pip install -r requirements.txt" with the
  specific list and exit cleanly (exit code 2) instead of stack-tracing.
- `main.py`: `simpleaudio` is now soft-optional. Falls back to stdlib
  `winsound` on Windows installs that couldn't build the C extension.
  Sound cues still work; only the precise wait_done semantics are
  slightly different.

VERIFIED LOCALLY

`.venv\Scripts\python.exe main.py` now prints:
```
============================================================
  J.A.R.V.I.S.  loading (Python edition)...
  Heavy modules (vosk / torch / pvrecorder) take a few seconds.
============================================================
[scheduler] thread started (1 tasks loaded)
============================================================
  J.A.R.V.I.S.  v0.4.1   [Python edition]
  Total commands: 200
============================================================
Using device: Микрофон (5- Fifine Microphone)
Jarvis (v0.4.1) начал свою работу ...
Yes, sir.
```

Total time to first banner: ~100ms (was 10-60s of nothing).
All 104 pytest tests still pass.
2026-05-24 22:12:24 +03:00
Bossiara13
64ad7b963e feat: wire effects into va_speak behind config.TTS_EFFECTS_ENABLED 2026-04-22 19:58:42 +03:00
Abraham
079cd97d6f some reformat 2023-04-16 16:59:18 +05:00
Abraham Tugalov
3fca0a4166 Revert "Поменял архитектуру, сильно уменьшил кол-во зависимостей, убрал pyaduio, porcupine" 2023-04-16 15:56:20 +05:00
Nick Bifle
964d25de86 Updated archtecture, fixed dependencies 2023-04-16 12:51:26 +03:00
Abraham
657230c904 Initial commit 2022-12-15 04:17:16 +05:00