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:
1 parent
c7da6cb8a8
commit
bd1e3ca2e6
7 files changed
+695
-89
No files matched your search
@@ -109,21 +109,24 @@ export function useOllamaDownload() {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await runInstaller(state.filePath);
|
||||
setState(prev => ({
|
||||
...prev,
|
||||
isInstalled: true,
|
||||
}));
|
||||
|
||||
// Iniciar verificação automática em segundo plano
|
||||
startAutoCheck();
|
||||
} catch (error) {
|
||||
setState(prev => ({
|
||||
...prev,
|
||||
downloadError: error instanceof Error ? error.message : 'Erro ao executar instalador',
|
||||
}));
|
||||
}
|
||||
// Optimistic UI: atualizar estado imediatamente antes da chamada Tauri
|
||||
setState(prev => ({
|
||||
...prev,
|
||||
isInstalled: true, // Marcar como instalado imediatamente
|
||||
}));
|
||||
|
||||
// Iniciar verificação automática em segundo plano imediatamente
|
||||
startAutoCheck();
|
||||
|
||||
// Chamar Tauri em background (não bloquear)
|
||||
runInstaller(state.filePath)
|
||||
.catch((error) => {
|
||||
setState(prev => ({
|
||||
...prev,
|
||||
downloadError: error instanceof Error ? error.message : 'Erro ao executar instalador',
|
||||
isInstalled: false, // Reverter se falhar
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
||||
const checkOllama = async (): Promise<boolean> => {
|
||||
|
||||
Reference in new issue
Block a user