Tray options implementation + Voice system rewrite + build fixes

This commit is contained in:
Priler 2026-01-07 23:29:46 +05:00
parent 412acb7e2d
commit 47b7e7a65d
117 changed files with 1300 additions and 2334 deletions

View file

@ -1,7 +1,7 @@
// 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, APP_CONFIG_DIR, APP_LOG_DIR, DB};
use jarvis_core::{config, db, i18n, voices, APP_CONFIG_DIR, APP_LOG_DIR, DB};
use parking_lot::RwLock;
use std::sync::Arc;
@ -30,6 +30,16 @@ fn main() {
// init i18n
i18n::init(&settings.language);
// init voices
if let Err(e) = voices::init(&settings.voice) {
eprintln!("Failed to init voices: {}", e);
}
// init audio backend
if let Err(e) = jarvis_core::audio::init() {
eprintln!("Failed to init audio: {:?}", e);
}
// set db
DB.set(Arc::new(RwLock::new(settings)))
.expect("DB already initialized");
@ -55,6 +65,8 @@ fn main() {
tauri_commands::get_author_name,
tauri_commands::get_repository_link,
tauri_commands::get_tg_official_link,
tauri_commands::get_boosty_link,
tauri_commands::get_patreon_link,
tauri_commands::get_feedback_link,
// fs
@ -79,6 +91,15 @@ fn main() {
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");

View file

@ -29,4 +29,12 @@ pub use stt::*;
// import i18n commands
mod i18n;
pub use i18n::*;
pub use i18n::*;
// import commands commands xD
mod commands;
pub use commands::*;
// import voices commands
mod voices;
pub use voices::*;

View file

@ -0,0 +1,22 @@
use jarvis_core::commands::{self, JCommand, JCommandsList};
use once_cell::sync::Lazy;
static COMMANDS: Lazy<Vec<JCommandsList>> = Lazy::new(|| {
commands::parse_commands().unwrap_or_default()
});
#[tauri::command]
pub fn get_commands_count() -> usize {
COMMANDS
.iter()
.map(|list| list.commands.len())
.sum()
}
#[tauri::command]
pub fn get_commands_list() -> Vec<JCommand> {
COMMANDS
.iter()
.flat_map(|list| list.commands.clone())
.collect()
}

View file

@ -0,0 +1,16 @@
use jarvis_core::voices::{self, structs::VoiceConfig};
#[tauri::command]
pub fn list_voices() -> Vec<VoiceConfig> {
voices::list_voices()
}
#[tauri::command]
pub fn get_voice(voice_id: String) -> Option<VoiceConfig> {
voices::get_voice(&voice_id)
}
#[tauri::command]
pub fn preview_voice(voice_id: String) {
voices::play_preview(&voice_id);
}