feat: initial commit of astra local voice agent

Lokaler deutscher Sprachagent für Apple Silicon: Pipecat-Pipeline mit
Nemotron-ASR (MLX), Qwen über natives Ollama /api/chat, und Pocket TTS.
Loopback-only WebRTC-Server mit Origin/Host-Härtung.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LVgSHNHdRx3UNTBodFmhRA
This commit is contained in:
Jeuner 2026-09-07 13:39:51 +02:00
commit a42b3e8d73
17 changed files with 1436 additions and 0 deletions

28
tests/test_stt.py Normal file
View file

@ -0,0 +1,28 @@
from unittest.mock import AsyncMock, patch
import pytest
from pipecat.processors.frame_processor import FrameDirection
from astra.core import Settings
from astra.inference import Models
from astra.services import NemotronSTTService
@pytest.mark.asyncio
async def test_recognition_failure_reaches_pipeline_upstream_and_notifies_browser():
models = Models(Settings())
notices = []
service = NemotronSTTService(models, notices.append)
service.push_frame = AsyncMock()
try:
service.queue.put_nowait(("start", b""))
with patch("astra.services.Recognizer", side_effect=RuntimeError("Model failed")):
await service._worker()
assert service.failed
assert notices[0]["type"] == "error"
assert "Model failed" in notices[0]["message"]
frame, direction = service.push_frame.call_args.args
assert frame.fatal
assert direction == FrameDirection.UPSTREAM
finally:
await models.close()