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.
This commit is contained in:
parent
d3180b7d78
commit
4f83062815
6 changed files with 430 additions and 0 deletions
38
resources/commands/interesting_fact/command.toml
Normal file
38
resources/commands/interesting_fact/command.toml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# Interesting fact about X via LLM.
|
||||
|
||||
[[commands]]
|
||||
id = "fact.about"
|
||||
type = "lua"
|
||||
script = "fact.lua"
|
||||
sandbox = "full"
|
||||
timeout = 15000
|
||||
|
||||
[commands.phrases]
|
||||
ru = [
|
||||
"расскажи интересный факт",
|
||||
"интересный факт о",
|
||||
"интересный факт про",
|
||||
"удиви меня",
|
||||
"интересный факт",
|
||||
"расскажи факт",
|
||||
]
|
||||
en = ["tell me an interesting fact", "fun fact about", "surprise me"]
|
||||
ua = ["цікавий факт"]
|
||||
|
||||
|
||||
[[commands]]
|
||||
id = "fact.history_today"
|
||||
type = "lua"
|
||||
script = "history_today.lua"
|
||||
sandbox = "full"
|
||||
timeout = 15000
|
||||
|
||||
[commands.phrases]
|
||||
ru = [
|
||||
"что было в этот день",
|
||||
"что произошло в этот день",
|
||||
"этот день в истории",
|
||||
"что случилось",
|
||||
]
|
||||
en = ["this day in history", "what happened today"]
|
||||
ua = ["що сталося в цей день"]
|
||||
35
resources/commands/interesting_fact/fact.lua
Normal file
35
resources/commands/interesting_fact/fact.lua
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
-- "Интересный факт о космосе" / "удиви меня"
|
||||
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)
|
||||
48
resources/commands/interesting_fact/history_today.lua
Normal file
48
resources/commands/interesting_fact/history_today.lua
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
-- "Что было в этот день в истории" — 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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue