From 7b1e94f6d78fa3a0a05841466f3254208eb0f4d0 Mon Sep 17 00:00:00 2001 From: Thales Maciel Date: Sat, 7 Feb 2026 15:45:10 -0300 Subject: [PATCH] Remove unused config fields --- README.md | 18 ++++++------------ src/config.py | 20 +------------------- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index f684645..b4b9ebb 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Python X11 transcription daemon that records audio, runs Whisper, logs the trans - `xclip` - `xdotool` - 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 @@ -38,19 +38,14 @@ Create `~/.config/lel/config.json`: "whisper_model": "base", "whisper_lang": "en", "whisper_device": "cpu", - "whisper_extra_args": "", "record_timeout_sec": 120, - "whisper_timeout_sec": 300, - "segment_sec": 5, - "streaming": false, "injection_backend": "clipboard", "ai_enabled": true, - "ai_provider": "ollama", "ai_model": "llama3.2:3b", "ai_temperature": 0.0, "ai_system_prompt_file": "", - "ai_base_url": "http://localhost:11434", + "ai_base_url": "http://localhost:11434/v1/chat/completions", "ai_api_key": "", "ai_timeout_sec": 20 } @@ -58,12 +53,11 @@ Create `~/.config/lel/config.json`: Env overrides: -- `WHISPER_MODEL`, `WHISPER_LANG`, `WHISPER_DEVICE`, `WHISPER_EXTRA_ARGS` +- `WHISPER_MODEL`, `WHISPER_LANG`, `WHISPER_DEVICE` - `WHISPER_FFMPEG_IN` -- `WHISPER_STREAM`, `WHISPER_SEGMENT_SEC`, `WHISPER_TIMEOUT_SEC` - `LEL_RECORD_TIMEOUT_SEC`, `LEL_HOTKEY`, `LEL_INJECTION_BACKEND` - `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` ## systemd user service @@ -87,9 +81,9 @@ Injection backends: - `clipboard`: copy to clipboard and inject via Ctrl+V (requires `xclip` + `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: diff --git a/src/config.py b/src/config.py index ba34808..7197cde 100644 --- a/src/config.py +++ b/src/config.py @@ -17,21 +17,16 @@ class Config: whisper_model: str = "base" whisper_lang: str = "en" whisper_device: str = "cpu" - whisper_extra_args: str = "" - whisper_timeout_sec: int = 300 record_timeout_sec: int = 120 - segment_sec: int = 5 - streaming: bool = False injection_backend: str = "clipboard" ai_enabled: bool = False - ai_provider: str = "ollama" ai_model: str = "llama3.2:3b" ai_temperature: float = 0.0 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_timeout_sec: int = 20 @@ -56,16 +51,8 @@ def load(path: str | None) -> Config: cfg.whisper_lang = os.environ["WHISPER_LANG"] if os.getenv("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"): 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"): cfg.ffmpeg_path = os.environ["LEL_FFMPEG_PATH"] @@ -78,8 +65,6 @@ def load(path: str | None) -> Config: if os.getenv("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"): cfg.ai_model = os.environ["LEL_AI_MODEL"] if os.getenv("LEL_AI_TEMPERATURE"): @@ -97,9 +82,6 @@ def load(path: str | None) -> Config: raise ValueError("hotkey cannot be empty") if cfg.record_timeout_sec <= 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