Files
OllaHub/hooks/use-hardware.ts
T
Evandro Fonseca Junior 84ea2dec19 feat: add emoji-regex and remove-accents dependencies; enhance chat and setup pages
- Added `emoji-regex` and `remove-accents` packages to improve text processing capabilities.
- Implemented automatic Ollama startup in the chat page for better user experience.
- Enhanced setup page to include GPU selection based on hardware specifications.
- Updated chat input to support real-time validation and improved user feedback.
- Refactored message handling in chat to incorporate new processing features.
2025-11-26 16:12:16 -03:00

33 lines
821 B
TypeScript

import { useState, useEffect } from 'react';
import { invoke } from '@tauri-apps/api/core';
import { SystemSpecs, GpuInfo } 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,
gpus: specs?.gpus || []
};
}