feat: enhance application functionality and telemetry monitoring

- Added new scripts in `package.json` for Python dependency installation and sidecar compilation.
- Integrated telemetry fetching in `src/App.tsx` to monitor CPU, RAM, GPU, and disk usage.
- Implemented model downloading functionality with progress tracking in `src/App.tsx`.
- Updated `Footer` and `Header` components to display telemetry data and settings options.
- Enhanced Tauri configuration for sidecar execution and application window settings.
- Updated Python requirements in `requirements.txt` to include additional dependencies for improved functionality.
This commit is contained in:
Evandro Fonseca Junior committed 2026-01-14 23:57:14 -03:00
1 parent 482b28513e
commit 08e154894a
24 files changed
+1110 -91

No files matched your search

+73
View File
@@ -791,6 +791,15 @@ version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7"
[[package]]
name = "encoding_rs"
version = "0.8.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
dependencies = [
"cfg-if",
]
[[package]]
name = "endi"
version = "1.1.1"
@@ -1868,6 +1877,7 @@ dependencies = [
"tauri",
"tauri-build",
"tauri-plugin-opener",
"tauri-plugin-shell",
]
[[package]]
@@ -2310,6 +2320,16 @@ dependencies = [
"pin-project-lite",
]
[[package]]
name = "os_pipe"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
dependencies = [
"libc",
"windows-sys 0.61.2",
]
[[package]]
name = "pango"
version = "0.18.3"
@@ -3201,12 +3221,44 @@ dependencies = [
"digest",
]
[[package]]
name = "shared_child"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e362d9935bc50f019969e2f9ecd66786612daae13e8f277be7bfb66e8bed3f7"
dependencies = [
"libc",
"sigchld",
"windows-sys 0.60.2",
]
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "sigchld"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47106eded3c154e70176fc83df9737335c94ce22f821c32d17ed1db1f83badb1"
dependencies = [
"libc",
"os_pipe",
"signal-hook",
]
[[package]]
name = "signal-hook"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2"
dependencies = [
"libc",
"signal-hook-registry",
]
[[package]]
name = "signal-hook-registry"
version = "1.4.8"
@@ -3618,6 +3670,27 @@ dependencies = [
"zbus",
]
[[package]]
name = "tauri-plugin-shell"
version = "2.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39b76f884a3937e04b631ffdc3be506088fa979369d25147361352f2f352e5ed"
dependencies = [
"encoding_rs",
"log",
"open",
"os_pipe",
"regex",
"schemars 0.8.22",
"serde",
"serde_json",
"shared_child",
"tauri",
"tauri-plugin",
"thiserror 2.0.17",
"tokio",
]
[[package]]
name = "tauri-runtime"
version = "2.9.2"
+1
View File
@@ -20,6 +20,7 @@ tauri-build = { version = "2", features = [] }
[dependencies]
tauri = { version = "2", features = [] }
tauri-plugin-opener = "2"
tauri-plugin-shell = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
+21
View File
@@ -0,0 +1,21 @@
# Binários do Sidecar
Esta pasta contém os binários compilados do engine-backend (Python).
## Compilação
### Linux (Manjaro)
```bash
pip install pyinstaller
pyinstaller --onefile --name engine-backend-x86_64-unknown-linux-gnu src-python/app/api_server.py
mv dist/engine-backend-x86_64-unknown-linux-gnu binaries/
```
### Windows
```powershell
pip install pyinstaller
pyinstaller --onefile --name engine-backend-x86_64-pc-windows-msvc src-python/app/api_server.py
move dist\engine-backend-x86_64-pc-windows-msvc.exe binaries\
```
**Nota:** O Tauri adicionará automaticamente a extensão `.exe` no Windows durante o build.
+11 -2
View File
@@ -1,10 +1,19 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"identifier": "main-capability",
"description": "Capability for the main window",
"windows": ["main"],
"permissions": [
"core:default",
"opener:default"
"opener:default",
{
"identifier": "shell:allow-execute",
"allow": [
{
"name": "binaries/engine-backend",
"sidecar": true
}
]
}
]
}
+57
View File
@@ -1,4 +1,12 @@
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
use tauri_plugin_shell::ShellExt;
use tauri_plugin_shell::process::CommandEvent;
use std::sync::{Arc, Mutex};
struct AppState {
child_process: Arc<Mutex<Option<tauri_plugin_shell::process::CommandChild>>>,
}
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
@@ -6,9 +14,58 @@ fn greet(name: &str) -> String {
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
let child_process = Arc::new(Mutex::new(Option::<tauri_plugin_shell::process::CommandChild>::None));
let child_process_clone = Arc::clone(&child_process);
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_shell::init())
.invoke_handler(tauri::generate_handler![greet])
.manage(AppState { child_process })
.setup(move |app| {
// Inicia o Sidecar Python (usado em dev e produção)
let shell = app.shell();
match shell.sidecar("engine-backend") {
Ok(sidecar) => {
match sidecar.spawn() {
Ok((mut rx, child)) => {
// Armazena a referência do processo para controle
let mut process_store = child_process_clone.lock().unwrap();
*process_store = Some(child);
// Monitoramento de logs em thread assíncrona
tauri::async_runtime::spawn(async move {
while let Some(event) = rx.recv().await {
if let CommandEvent::Stdout(line) = event {
println!("Backend Log: {}", String::from_utf8_lossy(&line));
}
}
});
println!("[System] Sidecar Python iniciado com sucesso");
}
Err(e) => {
eprintln!("[Erro] Falha ao iniciar sidecar: {}", e);
eprintln!("[Erro] Verifique se o binário está em src-tauri/binaries/");
eprintln!("[Erro] Execute: pnpm compile:sidecar");
}
}
}
Err(e) => {
eprintln!("[Erro] Falha ao configurar sidecar: {}", e);
eprintln!("[Erro] Verifique se o binário está em src-tauri/binaries/");
eprintln!("[Erro] Execute: pnpm compile:sidecar");
}
}
Ok(())
})
.on_window_event(|_window, event| {
// Garante o encerramento quando a janela fecha
if let tauri::WindowEvent::Destroyed = event {
println!("[System]: Encerrando Backend...");
}
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
+17 -14
View File
@@ -2,28 +2,19 @@
"$schema": "https://schema.tauri.app/config/2",
"productName": "localaiapp",
"version": "0.1.0",
"identifier": "evandrodevbr",
"identifier": "com.evandrodevbr.app",
"build": {
"beforeDevCommand": "pnpm dev",
"beforeDevCommand": "pnpm predev && pnpm dev",
"devUrl": "http://localhost:1420",
"beforeBuildCommand": "pnpm build",
"frontendDist": "../dist"
},
"app": {
"windows": [
{
"title": "localaiapp",
"width": 800,
"height": 600
}
],
"security": {
"csp": null
}
},
"bundle": {
"active": true,
"targets": "all",
"externalBin": [
"binaries/engine-backend"
],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
@@ -31,5 +22,17 @@
"icons/icon.icns",
"icons/icon.ico"
]
},
"app": {
"windows": [
{
"title": "LocalMind AI",
"width": 1200,
"height": 800
}
],
"security": {
"csp": null
}
}
}