Bossiara13
|
8d3da4ea06
|
feat: LLM hot-swap voice command + Ollama backend (148 → 151 commands)
Closes the last functional parity gap with rust. Python now has voice-driven
Ollama↔Groq switching, persistent across restarts.
llm_backend.py (new, ~130 lines)
Singleton module:
current_client() → active OpenAI client (or None)
current_backend() → 'groq' | 'ollama' | 'none'
current_model() → active model name
swap_to(name) → hot-swap + persist to <here>/llm_backend.txt
parse_backend(name) → ru/en alias normaliser ('облако'→groq, 'локальный'→ollama)
Backends:
- Groq: config.GROQ_TOKEN + GROQ_BASE_URL + GROQ_MODEL (defaults)
- Ollama: OLLAMA_BASE_URL (default http://localhost:11434/v1) +
OLLAMA_MODEL (default qwen2.5:3b). api_key='ollama' (placeholder,
openai lib insists on a non-empty string; Ollama ignores it).
Init precedence (idempotent _ensure_init):
1. Persisted choice from llm_backend.txt
2. JARVIS_LLM env var
3. Auto-detect: Groq if token present, else Ollama
Voice commands (commands.yaml, +3 entries → 151)
llm_switch_local → ollama
llm_switch_cloud → groq
llm_status → speaks current backend
extensions.py
+ do_llm_switch / do_llm_status handlers
+ llm_backend import
do_interesting_fact migrated off direct OpenAI(...) to use llm_backend.current_*
dev_handlers.py
+ llm_backend import
do_codebase_ask + do_github_summarize_pr migrated to llm_backend.current_*
vision_handler.py
Vision call documented as Groq-specific (Ollama doesn't expose vision via
OpenAI-compat in our stack), kept direct config.GROQ_TOKEN reading.
Tests: ast.parse passes for all 5 modules. yaml.safe_load = 151 entries.
PYTHON PARITY VS RUST IS NOW FUNCTIONALLY COMPLETE.
Only remaining rust-only feature: the Tauri GUI (python is console-only).
|
2026-05-16 00:44:42 +03:00 |
|
Bossiara13
|
6a328077bc
|
feat: vision + macros + scheduler in Python (129 → 142 commands)
Three big rust packs ported. Python parity now covers the FULL imba lineup
except codebase_qa and github_pr.
vision_handler.py (new, ~125 lines)
- Screenshot via PowerShell System.Drawing → temp PNG → base64 → Groq
vision API (llama-3.2-11b-vision-preview, override via GROQ_VISION_MODEL).
- do_vision_describe "что на экране" / "опиши экран"
- do_vision_read_error "прочитай ошибку"
- Requires GROQ_TOKEN; speaks "Не удалось" on missing.
macros_store.py (new, ~170 lines)
- JSON store at <here>/macros.json (atomic write-through).
- start(name) / save() / cancel() / replay(name, dispatch_fn)
- is_recording / recording_name / list_names / get / delete
- record_step(phrase) called by execute_cmd hook (see main.py)
- is_macro_control filter blocks "запиши макрос ..." from recording itself
(no infinite recursion).
- replay spawns daemon thread, fires each step with 800ms delay.
scheduler_store.py (new, ~220 lines)
- JSON store at <here>/schedule.json.
- parse_schedule(spec) handles "daily HH:MM", "at HH:MM",
"every/in N minutes|hours|seconds" — Russian (минут/час/секунд) + English.
- Background daemon thread ticks every 30s, fires Speak actions through the
same speak callback used by main.py.
- Once-tasks auto-delete after firing; daily/interval cycle forever.
- add/remove/clear/remove_by_text/list_all.
extensions.py (+13 handlers)
do_vision_describe / do_vision_read_error → thin proxies to vision_handler
do_macros_start / save / cancel / replay / list / delete
do_scheduler_add_reminder / add_recurring / list / clear / cancel_by_text
main.py
- extensions.init_background_services() at startup → scheduler thread boots.
- Wraps execute_cmd so every successful dispatch feeds macros_store.record_step.
- set_dispatch_fn(_execute_phrase_for_macro) enables macro replay through the
normal command pipeline (recognize_cmd → execute_cmd).
commands.yaml (+13 entries, 129 → 142)
vision_describe, vision_read_error, macros_start, macros_save, macros_cancel,
macros_replay, macros_list, macros_delete, scheduler_reminder,
scheduler_recurring, scheduler_list, scheduler_clear, scheduler_cancel_text.
Tests: ast.parse passes for all five .py files. yaml.safe_load = 142 entries.
Python parity status vs rust (72 packs):
✓ memory_pack, profile_switch, vision, scheduler, macros, llm switch
(via env), llm_context (basic), media_keys (existing), screenshot, net_info,
unit_convert, generators, disk, date_math, sleep_timer (via shutdown),
interesting_fact, mailto, self_check, ssl_check, intro/echo
✗ codebase_qa, github_pr (require gh CLI + file walk — TODO)
✗ pomodoro / daily_briefing / habit_nudge / quick_search / diagnostics
(could be ported but need scheduler integration + LLM glue)
|
2026-05-16 00:00:22 +03:00 |
|