Add context capture and rules

This commit is contained in:
Thales Maciel 2026-02-07 18:10:21 -03:00
parent 34ecdcbfde
commit 0e79edfa20
7 changed files with 247 additions and 80 deletions

View file

@ -8,7 +8,8 @@ Python X11 transcription daemon that records audio, runs Whisper, logs the trans
- `ffmpeg`
- `faster-whisper`
- Tray icon deps: `gtk3`
- Python deps: `pillow`, `python-xlib`, `faster-whisper`, `PyGObject`
- i3 window manager (focus metadata via i3 IPC)
- Python deps: `pillow`, `python-xlib`, `faster-whisper`, `PyGObject`, `i3ipc`
## Python Daemon
@ -39,6 +40,23 @@ Create `~/.config/lel/config.json`:
"record_timeout_sec": 120,
"injection_backend": "clipboard",
"context_capture": {
"provider": "i3ipc",
"on_focus_change": "abort"
},
"context_rules": [
{
"tag": "terminal",
"match": { "class": "Alacritty" },
"ai_enabled": false
},
{
"tag": "chat",
"match": { "title_contains": "Slack" },
"ai_prompt_file": "/home/thales/.config/lel/prompts/slack.txt"
}
],
"ai_enabled": true,
"ai_model": "llama3.2:3b",
"ai_temperature": 0.0,
@ -57,6 +75,7 @@ Env overrides:
- `LEL_FFMPEG_PATH`
- `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_CONTEXT_PROVIDER`, `LEL_CONTEXT_ON_FOCUS_CHANGE`
## systemd user service
@ -83,6 +102,12 @@ AI provider:
- Generic OpenAI-compatible chat API at `ai_base_url`
Context capture:
- `context_capture` stores the focused window at hotkey time (via i3 IPC).
- If focus changes before injection, the workflow aborts (interpreted as a cancel).
- `context_rules` lets you match on app/title and override AI/injection behavior.
Control:
```bash