Remove ai.enabled configuration support
This commit is contained in:
parent
ccf968a410
commit
2c570c7a87
5 changed files with 22 additions and 26 deletions
|
|
@ -41,11 +41,6 @@ class InjectionConfig:
|
|||
remove_transcription_from_clipboard: bool = False
|
||||
|
||||
|
||||
@dataclass
|
||||
class AiConfig:
|
||||
enabled: bool = True
|
||||
|
||||
|
||||
@dataclass
|
||||
class VocabularyReplacement:
|
||||
source: str
|
||||
|
|
@ -72,7 +67,6 @@ class Config:
|
|||
recording: RecordingConfig = field(default_factory=RecordingConfig)
|
||||
stt: SttConfig = field(default_factory=SttConfig)
|
||||
injection: InjectionConfig = field(default_factory=InjectionConfig)
|
||||
ai: AiConfig = field(default_factory=AiConfig)
|
||||
vocabulary: VocabularyConfig = field(default_factory=VocabularyConfig)
|
||||
domain_inference: DomainInferenceConfig = field(default_factory=DomainInferenceConfig)
|
||||
|
||||
|
|
@ -119,9 +113,6 @@ def validate(cfg: Config) -> None:
|
|||
if not isinstance(cfg.injection.remove_transcription_from_clipboard, bool):
|
||||
raise ValueError("injection.remove_transcription_from_clipboard must be boolean")
|
||||
|
||||
if not isinstance(cfg.ai.enabled, bool):
|
||||
raise ValueError("ai.enabled must be boolean")
|
||||
|
||||
cfg.vocabulary.max_rules = _validated_limit(cfg.vocabulary.max_rules, "vocabulary.max_rules")
|
||||
cfg.vocabulary.max_terms = _validated_limit(cfg.vocabulary.max_terms, "vocabulary.max_terms")
|
||||
|
||||
|
|
@ -151,6 +142,10 @@ def _from_dict(data: dict[str, Any], cfg: Config) -> Config:
|
|||
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
|
||||
|
|
@ -159,7 +154,6 @@ def _from_dict(data: dict[str, Any], cfg: Config) -> Config:
|
|||
"recording",
|
||||
"stt",
|
||||
"injection",
|
||||
"ai",
|
||||
"vocabulary",
|
||||
"domain_inference",
|
||||
)
|
||||
|
|
@ -169,7 +163,6 @@ def _from_dict(data: dict[str, Any], cfg: Config) -> Config:
|
|||
recording = _ensure_dict(data.get("recording"), "recording")
|
||||
stt = _ensure_dict(data.get("stt"), "stt")
|
||||
injection = _ensure_dict(data.get("injection"), "injection")
|
||||
ai = _ensure_dict(data.get("ai"), "ai")
|
||||
vocabulary = _ensure_dict(data.get("vocabulary"), "vocabulary")
|
||||
domain_inference = _ensure_dict(data.get("domain_inference"), "domain_inference")
|
||||
|
||||
|
|
@ -188,8 +181,6 @@ def _from_dict(data: dict[str, Any], cfg: Config) -> Config:
|
|||
injection["remove_transcription_from_clipboard"],
|
||||
"injection.remove_transcription_from_clipboard",
|
||||
)
|
||||
if "enabled" in ai:
|
||||
cfg.ai.enabled = _as_bool(ai["enabled"], "ai.enabled")
|
||||
if "replacements" in vocabulary:
|
||||
cfg.vocabulary.replacements = _as_replacements(vocabulary["replacements"])
|
||||
if "terms" in vocabulary:
|
||||
|
|
@ -218,8 +209,6 @@ def _from_dict(data: dict[str, Any], cfg: Config) -> Config:
|
|||
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")
|
||||
if "ai_enabled" in data:
|
||||
cfg.ai.enabled = _as_bool(data["ai_enabled"], "ai_enabled")
|
||||
return cfg
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue