Files
OllaHub/hooks/use-system-monitor.ts
Evandro Fonseca Junior 8834ef2b4f feat: update dependencies and enhance chat functionality
- Added new Radix UI components including checkbox, label, popover, slider, switch, and tooltip to improve UI interactions.
- Integrated react-syntax-highlighter for better code rendering in chat messages.
- Updated package.json and pnpm-lock.yaml to include new dependencies and ensure compatibility.
- Enhanced chat input to support web search toggling, improving user experience during message composition.
- Implemented auto-saving of chat sessions and improved session management features.
- Refactored chat message rendering to clean up metadata and improve display quality.
2025-11-20 04:26:35 -03:00

32 lines
644 B
TypeScript

import { useState, useEffect } from 'react';
import { invoke } from '@tauri-apps/api/core';
import { listen } from '@tauri-apps/api/event';
export interface SystemStats {
cpu_usage: number;
memory_used: number;
memory_total: number;
}
export function useSystemMonitor() {
const [stats, setStats] = useState<SystemStats | null>(null);
useEffect(() => {
// Start the monitor thread in backend
invoke('start_system_monitor');
const unlisten = listen<SystemStats>('system-stats', (event) => {
setStats(event.payload);
});
return () => {
unlisten.then(f => f());
};
}, []);
return stats;
}