Remove unused config fields

This commit is contained in:
Thales Maciel 2026-02-07 15:45:10 -03:00
parent bb7780c461
commit 7b1e94f6d7
2 changed files with 7 additions and 31 deletions

View file

@ -10,7 +10,7 @@ Python X11 transcription daemon that records audio, runs Whisper, logs the trans
- `xclip` - `xclip`
- `xdotool` - `xdotool`
- Tray icon deps: `libappindicator3` and `gtk3` (required by `systray`) - Tray icon deps: `libappindicator3` and `gtk3` (required by `systray`)
- Python deps: `pystray`, `pillow`, `python-xlib`, `ollama`, `faster-whisper` - Python deps: `pystray`, `pillow`, `python-xlib`, `faster-whisper`
## Python Daemon ## Python Daemon
@ -38,19 +38,14 @@ Create `~/.config/lel/config.json`:
"whisper_model": "base", "whisper_model": "base",
"whisper_lang": "en", "whisper_lang": "en",
"whisper_device": "cpu", "whisper_device": "cpu",
"whisper_extra_args": "",
"record_timeout_sec": 120, "record_timeout_sec": 120,
"whisper_timeout_sec": 300,
"segment_sec": 5,
"streaming": false,
"injection_backend": "clipboard", "injection_backend": "clipboard",
"ai_enabled": true, "ai_enabled": true,
"ai_provider": "ollama",
"ai_model": "llama3.2:3b", "ai_model": "llama3.2:3b",
"ai_temperature": 0.0, "ai_temperature": 0.0,
"ai_system_prompt_file": "", "ai_system_prompt_file": "",
"ai_base_url": "http://localhost:11434", "ai_base_url": "http://localhost:11434/v1/chat/completions",
"ai_api_key": "", "ai_api_key": "",
"ai_timeout_sec": 20 "ai_timeout_sec": 20
} }
@ -58,12 +53,11 @@ Create `~/.config/lel/config.json`:
Env overrides: Env overrides:
- `WHISPER_MODEL`, `WHISPER_LANG`, `WHISPER_DEVICE`, `WHISPER_EXTRA_ARGS` - `WHISPER_MODEL`, `WHISPER_LANG`, `WHISPER_DEVICE`
- `WHISPER_FFMPEG_IN` - `WHISPER_FFMPEG_IN`
- `WHISPER_STREAM`, `WHISPER_SEGMENT_SEC`, `WHISPER_TIMEOUT_SEC`
- `LEL_RECORD_TIMEOUT_SEC`, `LEL_HOTKEY`, `LEL_INJECTION_BACKEND` - `LEL_RECORD_TIMEOUT_SEC`, `LEL_HOTKEY`, `LEL_INJECTION_BACKEND`
- `LEL_FFMPEG_PATH` - `LEL_FFMPEG_PATH`
- `LEL_AI_ENABLED`, `LEL_AI_PROVIDER`, `LEL_AI_MODEL`, `LEL_AI_TEMPERATURE`, `LEL_AI_SYSTEM_PROMPT_FILE` - `LEL_AI_ENABLED`, `LEL_AI_MODEL`, `LEL_AI_TEMPERATURE`, `LEL_AI_SYSTEM_PROMPT_FILE`
- `LEL_AI_BASE_URL`, `LEL_AI_API_KEY`, `LEL_AI_TIMEOUT_SEC` - `LEL_AI_BASE_URL`, `LEL_AI_API_KEY`, `LEL_AI_TIMEOUT_SEC`
## systemd user service ## systemd user service
@ -87,9 +81,9 @@ Injection backends:
- `clipboard`: copy to clipboard and inject via Ctrl+V (requires `xclip` + `xdotool`) - `clipboard`: copy to clipboard and inject via Ctrl+V (requires `xclip` + `xdotool`)
- `injection`: type the text with simulated keypresses (requires `xdotool`) - `injection`: type the text with simulated keypresses (requires `xdotool`)
AI providers: AI provider:
- `ollama`: calls the local Ollama API - Generic OpenAI-compatible chat API at `ai_base_url`
Control: Control:

View file

@ -17,21 +17,16 @@ class Config:
whisper_model: str = "base" whisper_model: str = "base"
whisper_lang: str = "en" whisper_lang: str = "en"
whisper_device: str = "cpu" whisper_device: str = "cpu"
whisper_extra_args: str = ""
whisper_timeout_sec: int = 300
record_timeout_sec: int = 120 record_timeout_sec: int = 120
segment_sec: int = 5
streaming: bool = False
injection_backend: str = "clipboard" injection_backend: str = "clipboard"
ai_enabled: bool = False ai_enabled: bool = False
ai_provider: str = "ollama"
ai_model: str = "llama3.2:3b" ai_model: str = "llama3.2:3b"
ai_temperature: float = 0.0 ai_temperature: float = 0.0
ai_system_prompt_file: str = "" ai_system_prompt_file: str = ""
ai_base_url: str = "http://localhost:11434" ai_base_url: str = "http://localhost:11434/v1/chat/completions"
ai_api_key: str = "" ai_api_key: str = ""
ai_timeout_sec: int = 20 ai_timeout_sec: int = 20
@ -56,16 +51,8 @@ def load(path: str | None) -> Config:
cfg.whisper_lang = os.environ["WHISPER_LANG"] cfg.whisper_lang = os.environ["WHISPER_LANG"]
if os.getenv("WHISPER_DEVICE"): if os.getenv("WHISPER_DEVICE"):
cfg.whisper_device = os.environ["WHISPER_DEVICE"] cfg.whisper_device = os.environ["WHISPER_DEVICE"]
if os.getenv("WHISPER_EXTRA_ARGS"):
cfg.whisper_extra_args = os.environ["WHISPER_EXTRA_ARGS"]
if os.getenv("WHISPER_FFMPEG_IN"): if os.getenv("WHISPER_FFMPEG_IN"):
cfg.ffmpeg_input = os.environ["WHISPER_FFMPEG_IN"] cfg.ffmpeg_input = os.environ["WHISPER_FFMPEG_IN"]
if os.getenv("WHISPER_STREAM"):
cfg.streaming = _parse_bool(os.environ["WHISPER_STREAM"])
if os.getenv("WHISPER_SEGMENT_SEC"):
cfg.segment_sec = int(os.environ["WHISPER_SEGMENT_SEC"])
if os.getenv("WHISPER_TIMEOUT_SEC"):
cfg.whisper_timeout_sec = int(os.environ["WHISPER_TIMEOUT_SEC"])
if os.getenv("LEL_FFMPEG_PATH"): if os.getenv("LEL_FFMPEG_PATH"):
cfg.ffmpeg_path = os.environ["LEL_FFMPEG_PATH"] cfg.ffmpeg_path = os.environ["LEL_FFMPEG_PATH"]
@ -78,8 +65,6 @@ def load(path: str | None) -> Config:
if os.getenv("LEL_AI_ENABLED"): if os.getenv("LEL_AI_ENABLED"):
cfg.ai_enabled = _parse_bool(os.environ["LEL_AI_ENABLED"]) cfg.ai_enabled = _parse_bool(os.environ["LEL_AI_ENABLED"])
if os.getenv("LEL_AI_PROVIDER"):
cfg.ai_provider = os.environ["LEL_AI_PROVIDER"]
if os.getenv("LEL_AI_MODEL"): if os.getenv("LEL_AI_MODEL"):
cfg.ai_model = os.environ["LEL_AI_MODEL"] cfg.ai_model = os.environ["LEL_AI_MODEL"]
if os.getenv("LEL_AI_TEMPERATURE"): if os.getenv("LEL_AI_TEMPERATURE"):
@ -97,9 +82,6 @@ def load(path: str | None) -> Config:
raise ValueError("hotkey cannot be empty") raise ValueError("hotkey cannot be empty")
if cfg.record_timeout_sec <= 0: if cfg.record_timeout_sec <= 0:
raise ValueError("record_timeout_sec must be > 0") raise ValueError("record_timeout_sec must be > 0")
if cfg.whisper_timeout_sec <= 0:
raise ValueError("whisper_timeout_sec must be > 0")
return cfg return cfg