Mac M1 optimizations, fix train pipeline, add Hey Cosmo wake word model

- Fix install_mac.sh: use venv + Python 3.12 (3.14 incompatible with ML libs)
- Fix run_mac.sh: activate venv, add CPU thread optimization env vars
- Fix agent.py: remove f-string from SYSTEM_PROMPT template (NameError on import)
- Add missing deps: sounddevice, pydub, imageio-ffmpeg, omegaconf
- Optimize for M1: torch.inference_mode, set_num_threads, OMP/MKL tuning
- Switch to qwen2.5:3b for faster LLM responses on Mac
- Switch Whisper to medium model with auto compute (small+int8 had poor Russian)
- Add initial_prompt for better Russian transcription
- Add open_app tool for native macOS app launching
- Fix TTS: sanitize Latin text to Cyrillic for Silero compatibility
- Fix wake word echo: add cooldown after TTS, reset model state, raise threshold
- Make "Слушаю" TTS synchronous to avoid mic interference
- Fix train Dockerfile: remove tensorflow/onnx2tf (only ONNX needed), fix deps
- Fix train.sh: use wget for dataset download, add --shm-size=2g
- Add trained hey_cosmo.onnx wake word model
- Add TODO section to CLAUDE.md (ChatterBox TTS, Ollama Modelfile ideas)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-11 11:19:53 +03:00
parent 6010816f1d
commit 110d9cde29
15 changed files with 183 additions and 94 deletions

View File

@@ -61,9 +61,10 @@ def find_program(name: str) -> str:
"""
Найти программу или приложение на macOS по имени.
Ищет в PATH, /Applications, ~/Applications и через Spotlight (mdfind).
Возвращает путь. Чтобы запустить — используй open_app.
Args:
name: имя программы, например 'webstorm', 'chrome', 'cursor'
name: имя программы, например 'webstorm', 'chrome', 'cursor', 'safari'
"""
stem = name.strip()
logger.info(f"[find_program] {stem}")
@@ -92,6 +93,27 @@ def find_program(name: str) -> str:
return f"Программа '{name}' не найдена."
@tool
def open_app(name: str) -> str:
"""
Запустить приложение на macOS по имени или полному пути.
Примеры: open_app("Safari"), open_app("/Applications/Safari.app"), open_app("Telegram").
Args:
name: имя приложения или полный путь к .app
"""
logger.info(f"[open_app] {name}")
# Если передан полный путь к .app
if name.endswith(".app") and os.path.exists(name):
result = run_shell(f'open "{name}"')
else:
# Пробуем по имени через open -a
result = run_shell(f'open -a "{name}"')
if result.startswith("[ошибка") or "returncode=1" in result:
return f"Не удалось открыть '{name}'. Попробуй find_program чтобы найти точное имя."
return f"Приложение '{name}' запущено."
@tool
def open_browser(url: str, search: bool = False) -> str:
"""
@@ -197,6 +219,7 @@ def memory_list(prefix: str = "") -> str:
ALL_TOOLS = [
run_shell,
find_program,
open_app,
open_browser,
read_file,
write_file,