J.A.R.V.I.S-rust/resources/commands/interesting_fact/history_today.lua
Bossiara13 4f83062815 docs+feat: USAGE.md + interesting_fact + mailto packs
USAGE.md (new, ~250 lines)
  - Complete voice command reference organised by 13 categories
  - Table-formatted for fast skim ("Команда → Что делает")
  - Sections: Управление ассистентом / LLM / Память+профили+macros /
    Расписание / Окна+апп / Аудио+медиа / Система / Файлы+буфер /
    Информация из интернета / Утилиты-калькуляторы / Разработка /
    Развлечения / Скриншоты
  - Bottom: "Как добавить свою команду" with Lua snippet template,
    "Голосовое vs GUI" mapping, troubleshooting checklist (mic / TTS /
    LLM / command-not-found / logs).
  - Covers all 67 packs visible in resources/commands/.

interesting_fact pack (resources/commands/interesting_fact/, 2 cmds)
  - fact.about         "удиви меня" / "интересный факт про космос"
                       → LLM with "curious conversationalist" prompt,
                       generic or topic-targeted (1-2 sentences, no fluff).
  - fact.history_today "что было в этот день" / "этот день в истории"
                       → Wikipedia "On this day" API (RU first, EN fallback)
                       → LLM picks top 2-3 events, narrates concisely.

mailto pack (resources/commands/mailto/, 1 cmd)
  - mailto.compose     "напиши письмо" / "напиши письмо маме"
                       → opens default mail client via mailto: URI.
                       Looks up recipient via jarvis.memory ("email_маме")
                       if a name is given.
  - Pairs well with: jarvis.memory.remember("email_маме", "mom@example.com")

Pack count: 67 → 70. Tests: 112/112.
2026-05-15 23:38:03 +03:00

48 lines
1.8 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- "Что было в этот день в истории" — Wikipedia API + LLM сжатие.
local t = jarvis.context.time
-- Wikipedia's "On this day" Featured Content API:
-- https://api.wikimedia.org/feed/v1/wikipedia/ru/onthisday/events/MM/DD
local url = string.format(
"https://api.wikimedia.org/feed/v1/wikipedia/ru/onthisday/events/%02d/%02d",
t.month, t.day
)
local data = jarvis.http.json(url)
if not data or not data.events or #data.events == 0 then
-- fallback: EN
url = string.format(
"https://api.wikimedia.org/feed/v1/wikipedia/en/onthisday/events/%02d/%02d",
t.month, t.day
)
data = jarvis.http.json(url)
end
if not data or not data.events or #data.events == 0 then
return jarvis.cmd.not_found("На этот день в истории ничего интересного.")
end
-- Pick first 5 events to feed into LLM for summarisation
local sample = {}
for i = 1, math.min(5, #data.events) do
local ev = data.events[i]
local year = ev.year or "?"
local text = ev.text or ""
if text ~= "" then
table.insert(sample, year .. ": " .. text)
end
end
local context = table.concat(sample, "\n")
local reply = jarvis.llm({
{ role = "system", content = "Ты — историк. Из списка событий выбери 2-3 самых интересных для русскоязычного слушателя, расскажи коротко на русском. Без преамбул." },
{ role = "user", content = "Сегодня " .. t.day .. " число месяца " .. t.month .. ". События в этот день:\n\n" .. context }
}, { max_tokens = 350, temperature = 0.4 })
if not reply or reply == "" then
-- Fallback: just speak first event
return jarvis.cmd.ok(sample[1] or "Не нашёл интересного.")
end
return jarvis.cmd.ok(reply)