feat: Python parity for wol / banter / conversation / ddg_answer + 11 tests
New `wave59_handlers.py` (~250 lines) mirroring four Rust-only packs: - wol: pure-Python magic packet via socket + SO_BROADCAST. No PowerShell shellout (unlike the Rust pack). Reads MAC from memory_store under 'wol_<alias>' or JARVIS_WOL_TARGET env. Same MAC format tolerance (colons / dashes / dots / bare) as the Rust normaliser. - banter: pause/resume state + fire-one. Python edition doesn't run a background banter thread (the Rust daemon already does), so this is just the user-facing surface — same voice phrases work. - conversation: do_conversation_summary calls Groq with last 12 turns from main.py's `message_log`. set_history_ref() injects the live list reference at startup so the handler reads up-to-date history without a circular import. Offline-safe: GROQ_TOKEN missing → speak the last user message instead. do_conversation_repeat re-speaks the last assistant turn. - ddg_answer: urllib + DuckDuckGo Instant Answer JSON. Picks AbstractText → Answer → Definition → RelatedTopics[0]. Opens duckduckgo.com search fallback when nothing instant. extensions.py / main.py / commands.yaml: 7 new dispatch entries + proxy fns. commands.yaml now at 207 entries. tests/test_wave59_handlers.py: 11 unit tests for MAC normalisation, magic packet shape, WOL error paths, banter state machine, DDG trigger stripping, conversation history handling. Network calls deliberately NOT exercised here — they belong to integration tests. Tests: 104 → 115 (+11).
This commit is contained in:
parent
cdd331af35
commit
633850d0f7
5 changed files with 536 additions and 0 deletions
|
|
@ -1740,3 +1740,62 @@ expenses_breakdown:
|
|||
- на что я тратил
|
||||
- разбивка по категориям
|
||||
action: {type: expenses_breakdown}
|
||||
|
||||
wol_wake:
|
||||
phrases:
|
||||
- разбуди сервер
|
||||
- включи сервер
|
||||
- разбуди машину
|
||||
- разбуди компьютер
|
||||
- включи компьютер
|
||||
action: {type: wol}
|
||||
|
||||
banter_fire:
|
||||
phrases:
|
||||
- скажи что-нибудь интересное
|
||||
- пошути
|
||||
- развлеки меня
|
||||
- скучно мне
|
||||
action: {type: banter_fire}
|
||||
|
||||
banter_pause:
|
||||
phrases:
|
||||
- помолчи
|
||||
- не отвлекай меня
|
||||
- выключи болтовню
|
||||
action: {type: banter_pause}
|
||||
|
||||
banter_resume:
|
||||
phrases:
|
||||
- можешь говорить
|
||||
- включи болтовню
|
||||
- верни комментарии
|
||||
action: {type: banter_resume}
|
||||
|
||||
conversation_summary:
|
||||
phrases:
|
||||
- о чём мы говорили
|
||||
- о чем мы говорили
|
||||
- напомни о чем мы говорили
|
||||
- что мы недавно обсуждали
|
||||
- сделай выжимку разговора
|
||||
action: {type: conversation_summary}
|
||||
|
||||
conversation_repeat:
|
||||
phrases:
|
||||
- повтори
|
||||
- повтори последнее
|
||||
- что ты сказал
|
||||
- не расслышал
|
||||
action: {type: conversation_repeat}
|
||||
|
||||
ddg_answer:
|
||||
phrases:
|
||||
- что такое
|
||||
- кто такой
|
||||
- кто такая
|
||||
- расскажи про
|
||||
- расскажи о
|
||||
- найди информацию о
|
||||
- поищи в интернете
|
||||
action: {type: ddg_answer}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue