feat: add diarization config defaults (enabled=false, hf_token)
This commit is contained in:
@@ -28,6 +28,10 @@ DEFAULTS = {
|
|||||||
"network": {
|
"network": {
|
||||||
"host": "127.0.0.1",
|
"host": "127.0.0.1",
|
||||||
},
|
},
|
||||||
|
"diarization": {
|
||||||
|
"enabled": False,
|
||||||
|
"hf_token": "",
|
||||||
|
},
|
||||||
"pid_file": os.path.expanduser("~/.local/run/tueit-transcriber.pid"),
|
"pid_file": os.path.expanduser("~/.local/run/tueit-transcriber.pid"),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,4 +67,5 @@ def _write_defaults():
|
|||||||
f.write('[whisper]\nmodel = "large-v3"\nlanguage = "de"\ndevice = "auto"\nbase_url = ""\n\n')
|
f.write('[whisper]\nmodel = "large-v3"\nlanguage = "de"\ndevice = "auto"\nbase_url = ""\n\n')
|
||||||
f.write('[audio]\ndevice = ""\n\n')
|
f.write('[audio]\ndevice = ""\n\n')
|
||||||
f.write('[server]\nport = 8765\n\n')
|
f.write('[server]\nport = 8765\n\n')
|
||||||
f.write(f'[output]\npath = "{DEFAULTS["output"]["path"]}"\n')
|
f.write(f'[output]\npath = "{DEFAULTS["output"]["path"]}"\n\n')
|
||||||
|
f.write('[diarization]\nenabled = false\nhf_token = ""\n\n')
|
||||||
|
|||||||
@@ -35,3 +35,16 @@ def test_config_has_audio_and_whisper_base_url():
|
|||||||
assert "audio" in cfg
|
assert "audio" in cfg
|
||||||
assert cfg["audio"]["device"] == ""
|
assert cfg["audio"]["device"] == ""
|
||||||
assert cfg["whisper"]["base_url"] == ""
|
assert cfg["whisper"]["base_url"] == ""
|
||||||
|
|
||||||
|
|
||||||
|
def test_config_has_diarization_defaults():
|
||||||
|
from unittest.mock import patch
|
||||||
|
import tempfile, os
|
||||||
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
|
cfg_path = os.path.join(tmpdir, "config.toml")
|
||||||
|
with patch("config.CONFIG_PATH", cfg_path):
|
||||||
|
import config
|
||||||
|
cfg = config.load()
|
||||||
|
assert "diarization" in cfg
|
||||||
|
assert cfg["diarization"]["enabled"] is False
|
||||||
|
assert cfg["diarization"]["hf_token"] == ""
|
||||||
|
|||||||
Reference in New Issue
Block a user