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,28 @@
|
||||
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 };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user