J.A.R.V.I.S-rust/resources/commands/interesting_fact/fact.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

35 lines
1.6 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.

-- "Интересный факт о космосе" / "удиви меня"
local phrase = (jarvis.context.phrase or ""):lower()
local topic = jarvis.text.strip_trigger(phrase, {
"расскажи интересный факт про",
"расскажи интересный факт о",
"интересный факт про",
"интересный факт о",
"расскажи интересный факт",
"интересный факт",
"расскажи факт",
"удиви меня",
"tell me an interesting fact",
"fun fact about",
"surprise me",
"цікавий факт",
})
topic = topic:gsub("^[%s,:%.]+", ""):gsub("%s+$", "")
local user_prompt
if topic == "" then
user_prompt = "Расскажи один реально неочевидный научно-проверенный факт. На русском, 1-2 предложения. Без вступлений типа 'знали ли вы'."
else
user_prompt = "Расскажи один интересный факт про " .. topic .. ". На русском, 1-2 предложения. Без вступлений."
end
local reply = jarvis.llm({
{ role = "system", content = "Ты любопытный собеседник. Говоришь короткими, цепляющими фактами без воды." },
{ role = "user", content = user_prompt }
}, { max_tokens = 200, temperature = 0.8 })
if not reply or reply == "" then
return jarvis.cmd.error("Сегодня нет интересных фактов.")
end
return jarvis.cmd.ok(reply)