fix: address issues in model pull and chat API
- Refactored model pull logic to improve error handling and user feedback. - Enhanced chat API to ensure better performance and reliability during message fetching. - Updated UI components for a more intuitive user experience when interacting with models and messages.
This commit is contained in:
1 parent
ad9d5d32d2
commit
b2a06ed994
261 files changed
+19968
No files matched your search
@@ -0,0 +1,29 @@
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user