Remove legacy compatibility paths
This commit is contained in:
parent
5b38cc7dcd
commit
b42298b9b5
8 changed files with 23 additions and 323 deletions
|
|
@ -51,11 +51,6 @@ class VocabularyConfig:
|
|||
terms: list[str] = field(default_factory=list)
|
||||
|
||||
|
||||
@dataclass
|
||||
class DomainInferenceConfig:
|
||||
enabled: bool = True
|
||||
|
||||
|
||||
@dataclass
|
||||
class Config:
|
||||
daemon: DaemonConfig = field(default_factory=DaemonConfig)
|
||||
|
|
@ -63,7 +58,6 @@ class Config:
|
|||
stt: SttConfig = field(default_factory=SttConfig)
|
||||
injection: InjectionConfig = field(default_factory=InjectionConfig)
|
||||
vocabulary: VocabularyConfig = field(default_factory=VocabularyConfig)
|
||||
domain_inference: DomainInferenceConfig = field(default_factory=DomainInferenceConfig)
|
||||
|
||||
|
||||
def load(path: str | None) -> Config:
|
||||
|
|
@ -124,20 +118,7 @@ def validate(cfg: Config) -> None:
|
|||
cfg.vocabulary.replacements = _validate_replacements(cfg.vocabulary.replacements)
|
||||
cfg.vocabulary.terms = _validate_terms(cfg.vocabulary.terms)
|
||||
|
||||
if not isinstance(cfg.domain_inference.enabled, bool):
|
||||
raise ValueError("domain_inference.enabled must be boolean")
|
||||
|
||||
|
||||
def _from_dict(data: dict[str, Any], cfg: Config) -> Config:
|
||||
if "logging" in data:
|
||||
raise ValueError("logging section is no longer supported; use -v/--verbose")
|
||||
if "log_transcript" in data:
|
||||
raise ValueError("log_transcript is no longer supported; use -v/--verbose")
|
||||
if "ai" in data:
|
||||
raise ValueError("ai section is no longer supported")
|
||||
if "ai_enabled" in data:
|
||||
raise ValueError("ai_enabled is no longer supported")
|
||||
|
||||
has_sections = any(
|
||||
key in data
|
||||
for key in (
|
||||
|
|
@ -146,7 +127,6 @@ def _from_dict(data: dict[str, Any], cfg: Config) -> Config:
|
|||
"stt",
|
||||
"injection",
|
||||
"vocabulary",
|
||||
"domain_inference",
|
||||
)
|
||||
)
|
||||
if has_sections:
|
||||
|
|
@ -155,7 +135,6 @@ def _from_dict(data: dict[str, Any], cfg: Config) -> Config:
|
|||
stt = _ensure_dict(data.get("stt"), "stt")
|
||||
injection = _ensure_dict(data.get("injection"), "injection")
|
||||
vocabulary = _ensure_dict(data.get("vocabulary"), "vocabulary")
|
||||
domain_inference = _ensure_dict(data.get("domain_inference"), "domain_inference")
|
||||
|
||||
if "hotkey" in daemon:
|
||||
cfg.daemon.hotkey = _as_nonempty_str(daemon["hotkey"], "daemon.hotkey")
|
||||
|
|
@ -176,28 +155,8 @@ def _from_dict(data: dict[str, Any], cfg: Config) -> Config:
|
|||
cfg.vocabulary.replacements = _as_replacements(vocabulary["replacements"])
|
||||
if "terms" in vocabulary:
|
||||
cfg.vocabulary.terms = _as_terms(vocabulary["terms"])
|
||||
if "max_rules" in vocabulary:
|
||||
raise ValueError("vocabulary.max_rules is no longer supported")
|
||||
if "max_terms" in vocabulary:
|
||||
raise ValueError("vocabulary.max_terms is no longer supported")
|
||||
if "enabled" in domain_inference:
|
||||
cfg.domain_inference.enabled = _as_bool(
|
||||
domain_inference["enabled"], "domain_inference.enabled"
|
||||
)
|
||||
if "mode" in domain_inference:
|
||||
raise ValueError("domain_inference.mode is no longer supported")
|
||||
return cfg
|
||||
|
||||
if "hotkey" in data:
|
||||
cfg.daemon.hotkey = _as_nonempty_str(data["hotkey"], "hotkey")
|
||||
if "input" in data:
|
||||
cfg.recording.input = _as_recording_input(data["input"])
|
||||
if "whisper_model" in data:
|
||||
cfg.stt.model = _as_nonempty_str(data["whisper_model"], "whisper_model")
|
||||
if "whisper_device" in data:
|
||||
cfg.stt.device = _as_nonempty_str(data["whisper_device"], "whisper_device")
|
||||
if "injection_backend" in data:
|
||||
cfg.injection.backend = _as_nonempty_str(data["injection_backend"], "injection_backend")
|
||||
return cfg
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue