Initialize the stentor-gateway project with WebSocket-based voice pipeline orchestrating STT → Agent → TTS via OpenAI-compatible APIs. - Add FastAPI app with WebSocket endpoint for audio streaming - Add pipeline orchestration (stt_client, tts_client, agent_client) - Add Pydantic Settings configuration and message models - Add audio utilities for PCM/WAV conversion and resampling - Add health check endpoints - Add Dockerfile and pyproject.toml with dependencies - Add initial test suite (pipeline, STT, TTS, WebSocket) - Add comprehensive README covering gateway and ESP32 ear design - Clean up .gitignore for Python/uv project
35 lines
848 B
Python
35 lines
848 B
Python
"""Shared test fixtures for Stentor Gateway tests."""
|
|
|
|
import pytest
|
|
|
|
from stentor.config import Settings
|
|
|
|
|
|
@pytest.fixture
|
|
def settings() -> Settings:
|
|
"""Test settings with localhost endpoints."""
|
|
return Settings(
|
|
stt_url="http://localhost:9001",
|
|
tts_url="http://localhost:9002",
|
|
agent_url="http://localhost:9003",
|
|
log_level="DEBUG",
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_pcm() -> bytes:
|
|
"""Generate 1 second of silent PCM audio (16kHz, mono, 16-bit)."""
|
|
import struct
|
|
|
|
num_samples = 16000 # 1 second at 16kHz
|
|
return struct.pack(f"<{num_samples}h", *([0] * num_samples))
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_pcm_short() -> bytes:
|
|
"""Generate 100ms of silent PCM audio."""
|
|
import struct
|
|
|
|
num_samples = 1600 # 100ms at 16kHz
|
|
return struct.pack(f"<{num_samples}h", *([0] * num_samples))
|