mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-30 10:52:15 +00:00
feat(speech): add SpeechConfig to configuration system
Add SpeechConfig dataclass with backend, model, language, device, and compute_type fields. Wire it into JarvisConfig and load_config() so [speech] TOML sections are loaded automatically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
4c76b93569
commit
8b2bf136f1
@@ -830,6 +830,17 @@ class OperatorsConfig:
|
||||
auto_activate: str = "" # Comma-separated operator IDs
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class SpeechConfig:
|
||||
"""Speech-to-text settings."""
|
||||
|
||||
backend: str = "auto" # "auto", "faster-whisper", "whisper-cpp", "openai", "deepgram"
|
||||
model: str = "base" # Whisper model size: tiny, base, small, medium, large-v3
|
||||
language: str = "" # Empty = auto-detect
|
||||
device: str = "auto" # "auto", "cpu", "cuda"
|
||||
compute_type: str = "float16" # "float16", "int8", "float32"
|
||||
|
||||
|
||||
@dataclass
|
||||
class JarvisConfig:
|
||||
"""Top-level configuration for OpenJarvis."""
|
||||
@@ -851,6 +862,7 @@ class JarvisConfig:
|
||||
sessions: SessionConfig = field(default_factory=SessionConfig)
|
||||
a2a: A2AConfig = field(default_factory=A2AConfig)
|
||||
operators: OperatorsConfig = field(default_factory=OperatorsConfig)
|
||||
speech: SpeechConfig = field(default_factory=SpeechConfig)
|
||||
|
||||
@property
|
||||
def memory(self) -> StorageConfig:
|
||||
@@ -945,6 +957,7 @@ def load_config(path: Optional[Path] = None) -> JarvisConfig:
|
||||
"server", "telemetry", "traces", "security",
|
||||
"channel", "tools", "sandbox", "scheduler",
|
||||
"workflow", "sessions", "a2a", "operators",
|
||||
"speech",
|
||||
)
|
||||
for section_name in top_sections:
|
||||
if section_name in data:
|
||||
@@ -1196,6 +1209,7 @@ __all__ = [
|
||||
"SessionConfig",
|
||||
"SignalChannelConfig",
|
||||
"SlackChannelConfig",
|
||||
"SpeechConfig",
|
||||
"StorageConfig",
|
||||
"TeamsChannelConfig",
|
||||
"TelegramChannelConfig",
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
"""Tests for speech configuration."""
|
||||
|
||||
from openjarvis.core.config import JarvisConfig, SpeechConfig
|
||||
|
||||
|
||||
def test_speech_config_defaults():
|
||||
cfg = SpeechConfig()
|
||||
assert cfg.backend == "auto"
|
||||
assert cfg.model == "base"
|
||||
assert cfg.language == ""
|
||||
assert cfg.device == "auto"
|
||||
assert cfg.compute_type == "float16"
|
||||
|
||||
|
||||
def test_jarvis_config_has_speech():
|
||||
cfg = JarvisConfig()
|
||||
assert hasattr(cfg, "speech")
|
||||
assert isinstance(cfg.speech, SpeechConfig)
|
||||
assert cfg.speech.backend == "auto"
|
||||
Reference in New Issue
Block a user