refactor: optimize system health monitoring and UI interactions

- Removed unnecessary delay in chat redirection for immediate user feedback.
- Enhanced TitleBar component with a system health indicator, displaying RAM and CPU usage.
- Implemented optimistic UI updates for model downloads and Ollama installation, improving responsiveness.
- Introduced background health monitoring to prevent resource overload during operations.
- Added cleanup logic for child processes to ensure proper resource management during application shutdown.
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-28 15:42:40 -03:00
1 parent c7da6cb8a8
commit bd1e3ca2e6
7 files changed
+695 -89

No files matched your search

+12 -10
View File
@@ -115,19 +115,21 @@ export function ModelSelector({ recommendation, onComplete }: ModelSelectorProps
};
const handleDownload = async () => {
// Optimistic UI: atualizar estado imediatamente antes da chamada Tauri
setIsDownloading(true);
setDownloadProgress(0);
setDownloadStatus("Iniciando download...");
try {
await invoke('pull_model', { name: selectedModelId });
// O status será atualizado pelo listener quando o download completar
// Não precisamos setar aqui pois o listener já faz isso
} catch (error) {
console.error("Download failed", error);
setDownloadStatus("Falha no download. Tente novamente.");
setDownloadProgress(0);
setIsDownloading(false);
}
// Chamar Tauri em background (não bloquear)
invoke('pull_model', { name: selectedModelId })
.catch((error) => {
console.error("Download failed", error);
setDownloadStatus("Falha no download. Tente novamente.");
setDownloadProgress(0);
setIsDownloading(false);
});
// O status será atualizado pelo listener quando o download completar
// Não precisamos aguardar aqui pois o listener já faz isso
};
return (