Files
OllaHub/hooks/use-hardware.ts
T
Evandro Fonseca Junior b2a06ed994 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.
2025-11-19 00:01:14 -03:00

29 lines
771 B
TypeScript

import { useState, useEffect } from 'react';
import { invoke } from '@tauri-apps/api/core';
import { SystemSpecs } from '@/lib/recommendation';
export function useHardware() {
const [specs, setSpecs] = useState<SystemSpecs | null>(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
async function fetchSpecs() {
try {
const data = await invoke<SystemSpecs>('get_system_specs');
// Simulate a small delay for the "scanning" effect
setTimeout(() => {
setSpecs(data);
setLoading(false);
}, 1500);
} catch (error) {
console.error("Failed to get system specs:", error);
setLoading(false);
}
}
fetchSpecs();
}, []);
return { specs, loading };
}