Iron Man icon regenerated from resources/icons/icon.png at sizes 16/24/32/48/64/128/256 via Pillow (make_ico.py committed alongside); icon.ico is now a clean 83 KB multi-res for sharp display at any scale instead of whatever placeholder Tauri originally emitted. dotenvy added to workspace deps. jarvis-app/main.rs and jarvis-gui/ main.rs both walk up from current_exe() looking for dev.env (up to 5 parent levels), so the Desktop shortcut can launch the exe directly without a wrapper .bat to pre-set GROQ_TOKEN. Falls back to dotenvy::dotenv() (cwd lookup) if nothing found near the binary. 5 new portable Lua command packs. Bumps total from 21 to 26. cargo test -p jarvis-core --lib commands::tests still passes 3/3. reminders/ — set_reminder. Parses "напомни через N (секунд|минут| часов) <body>" or English equivalents; understands one Russian word numerals (один, две, пять, десять, пятнадцать, ...) for the count when speech recognition returns words instead of digits. Defaults to 5 minutes if number/unit missing. Spawns a detached PowerShell that Start-Sleeps then fires: BurntToast if installed, System.Speech SAPI (ru-RU voice preference), and a WScript.Shell.Popup as the guaranteed-visible last resort. date_query/ — today / tomorrow / yesterday. Single answer.lua keyed by command_id, computes the offset via PowerShell Get-Date.AddDays() in ru-RU culture so the weekday/month come out in Russian, then speaks via SAPI. voice_type/ — type_text. Strips the trigger, drops the remainder to clipboard via jarvis.system.clipboard.set, then synthesises Ctrl+V through user32!keybd_event so it lands in whatever window currently has focus. Works in any text field (note app, browser, IDE, Telegram, etc.). dice/ — coin_flip / roll_dice / random_number. Single roll.lua, seeds math.random with os.time + jitter, speaks the result. "1-6" for dice, "1-100" for random. stopwatch/ — start / check / stop. Uses jarvis.state.get/set (persisted via jarvis-core's settings DB) to remember the start timestamp, computes elapsed via jarvis.context.time.timestamp, formats as "X сек" / "X мин Y сек" / "X ч Y мин Z сек". All new packs follow the established patterns (sandbox=full, PS-via- exec helper where needed, USERPROFILE/SystemDrive everywhere, no hardcoded paths).
125 lines
3.7 KiB
Rust
125 lines
3.7 KiB
Rust
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
|
|
|
use jarvis_core::{config, db, i18n, voices, DB, SettingsManager};
|
|
|
|
#[macro_use]
|
|
extern crate simple_log;
|
|
|
|
mod events;
|
|
|
|
mod tauri_commands;
|
|
|
|
#[derive(Clone)]
|
|
pub struct AppState {
|
|
pub settings: SettingsManager,
|
|
}
|
|
|
|
fn main() {
|
|
load_dotenv_near_exe();
|
|
|
|
config::init_dirs().expect("Failed to init dirs");
|
|
|
|
// basic logging setup (simpler for GUI)
|
|
simple_log::quick!("info");
|
|
|
|
// init settings
|
|
let manager = db::init();
|
|
|
|
// init i18n
|
|
i18n::init(&manager.lock().language);
|
|
|
|
// init voices
|
|
if let Err(e) = voices::init(&manager.lock().voice, &manager.lock().language) {
|
|
eprintln!("Failed to init voices: {}", e);
|
|
}
|
|
|
|
// init audio backend
|
|
if let Err(e) = jarvis_core::audio::init() {
|
|
eprintln!("Failed to init audio: {:?}", e);
|
|
}
|
|
|
|
// set global DB (for core modules that read settings at init time)
|
|
DB.set(manager.arc().clone())
|
|
.expect("DB already initialized");
|
|
|
|
tauri::Builder::default()
|
|
.manage(AppState { settings: manager })
|
|
.plugin(tauri_plugin_shell::init())
|
|
.plugin(tauri_plugin_dialog::init())
|
|
.plugin(tauri_plugin_fs::init())
|
|
.invoke_handler(tauri::generate_handler![
|
|
// audio
|
|
tauri_commands::pv_get_audio_devices,
|
|
tauri_commands::pv_get_audio_device_name,
|
|
tauri_commands::play_sound,
|
|
|
|
// db
|
|
tauri_commands::db_read,
|
|
tauri_commands::db_write,
|
|
|
|
// etc
|
|
tauri_commands::get_app_version,
|
|
tauri_commands::get_author_name,
|
|
tauri_commands::get_repository_link,
|
|
tauri_commands::get_upstream_link,
|
|
tauri_commands::get_issues_link,
|
|
tauri_commands::get_python_fork_link,
|
|
|
|
// fs
|
|
tauri_commands::get_log_file_path,
|
|
tauri_commands::show_in_folder,
|
|
|
|
// sys
|
|
tauri_commands::get_current_ram_usage,
|
|
tauri_commands::get_peak_ram_usage,
|
|
tauri_commands::get_cpu_temp,
|
|
tauri_commands::get_cpu_usage,
|
|
tauri_commands::get_jarvis_app_stats,
|
|
tauri_commands::is_jarvis_app_running,
|
|
tauri_commands::run_jarvis_app,
|
|
|
|
// vosk
|
|
tauri_commands::list_vosk_models,
|
|
|
|
// gliner
|
|
tauri_commands::list_gliner_models,
|
|
|
|
// i18n
|
|
tauri_commands::get_translations,
|
|
tauri_commands::translate,
|
|
tauri_commands::get_current_language,
|
|
tauri_commands::set_language,
|
|
tauri_commands::get_supported_languages,
|
|
|
|
// commands
|
|
tauri_commands::get_commands_count,
|
|
tauri_commands::get_commands_list,
|
|
|
|
// voices
|
|
tauri_commands::list_voices,
|
|
tauri_commands::get_voice,
|
|
tauri_commands::preview_voice,
|
|
])
|
|
.run(tauri::generate_context!())
|
|
.expect("error while running tauri application");
|
|
}
|
|
|
|
// Pull dev.env into the process env so secrets like GROQ_TOKEN are picked up
|
|
// when the user launches the exe directly (no wrapper .bat required).
|
|
fn load_dotenv_near_exe() {
|
|
if let Ok(exe) = std::env::current_exe() {
|
|
let mut dir = exe.parent().map(|p| p.to_path_buf());
|
|
for _ in 0..5 {
|
|
if let Some(d) = &dir {
|
|
let candidate = d.join("dev.env");
|
|
if candidate.is_file() {
|
|
let _ = dotenvy::from_path(&candidate);
|
|
return;
|
|
}
|
|
dir = d.parent().map(|p| p.to_path_buf());
|
|
}
|
|
}
|
|
}
|
|
let _ = dotenvy::dotenv();
|
|
}
|