Files
Lumotia/src-tauri/src/commands/hardware.rs
Jake 089349d966
Some checks failed
check / cargo check (macos-latest) (push) Has been cancelled
check / cargo check (ubuntu-22.04) (push) Has been cancelled
check / cargo check (windows-latest) (push) Has been cancelled
check / svelte build + lint (push) Has been cancelled
agent: lumotia-rebrand — rust workspace crates magnotia-* -> lumotia-*
Phase 2 of the rebrand cascade. Renames all 9 workspace crates from
magnotia-* to lumotia-* plus the src-tauri binary crate name:

- magnotia-ai-formatting   -> lumotia-ai-formatting
- magnotia-audio           -> lumotia-audio
- magnotia-cloud-providers -> lumotia-cloud-providers
- magnotia-core            -> lumotia-core
- magnotia-hotkey          -> lumotia-hotkey
- magnotia-llm             -> lumotia-llm
- magnotia-mcp             -> lumotia-mcp
- magnotia-storage         -> lumotia-storage
- magnotia-transcription   -> lumotia-transcription
- magnotia                 -> lumotia (src-tauri binary)
- magnotia_lib             -> lumotia_lib (src-tauri lib target)

Crate directories (crates/audio/ etc.) stay as-is; only the Cargo.toml
[package] name field changes plus all consumer module imports
(magnotia_core -> lumotia_core, etc.).

Remaining magnotia_* references at this point are intentional and
scoped to later phases: tracing targets (Phase 4), DB setting keys
magnotia_preferences/magnotia_history (Phase 5).

cargo build --workspace passes. cargo test --workspace: 330 pass, 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 08:48:09 +01:00

70 lines
2.0 KiB
Rust

use serde::Serialize;
use lumotia_core::hardware::{self, Os};
use lumotia_core::recommendation;
#[derive(Serialize)]
pub struct SystemInfo {
pub ram_mb: u64,
pub cpu_brand: String,
pub cpu_cores: usize,
pub os: String,
pub gpu: Option<String>,
}
#[derive(Serialize)]
pub struct ModelRecommendation {
pub id: String,
pub display_name: &'static str,
pub disk_size_mb: u64,
pub ram_required_mb: u64,
pub description: &'static str,
pub score: f64,
pub reason: String,
pub is_downloaded: bool,
}
/// Probe system hardware and return a summary.
#[tauri::command]
pub fn probe_system() -> Result<SystemInfo, String> {
let profile = hardware::probe_system();
Ok(SystemInfo {
ram_mb: profile.ram.0,
cpu_brand: profile.cpu.brand,
cpu_cores: profile.cpu.logical_processors,
os: match profile.os {
Os::Windows => "Windows",
Os::Linux => "Linux",
Os::MacOs => "macOS",
Os::Ios => "iOS",
Os::Android => "Android",
}
.to_string(),
gpu: profile.gpu.map(|g| format!("{:?}", g.vendor)),
})
}
/// Rank models for the current system and return recommendations.
#[tauri::command]
pub fn rank_models() -> Result<Vec<ModelRecommendation>, String> {
let profile = hardware::probe_system();
let ranked = recommendation::rank_recommendations(&profile);
Ok(ranked
.into_iter()
.map(|scored| {
let downloaded = lumotia_transcription::is_downloaded(&scored.entry.id);
ModelRecommendation {
id: scored.entry.id.as_str().to_string(),
display_name: scored.entry.display_name,
disk_size_mb: scored.entry.disk_size.0,
ram_required_mb: scored.entry.ram_required.0,
description: scored.entry.description,
score: scored.score,
reason: scored.reason,
is_downloaded: downloaded,
}
})
.collect())
}