Dinh Long Nguyen e1c8d98bf2
Backend Architecture Refactoring (#6094) (#6162)
* add llamacpp plugin

* Refactor llamacpp plugin

* add utils plugin

* remove utils folder

* add hardware implementation

* add utils folder + move utils function

* organize cargo files

* refactor utils src

* refactor util

* apply fmt

* fmt

* Update gguf + reformat

* add permission for gguf commands

* fix cargo test windows

* revert yarn lock

* remove cargo.lock for hardware plugin

* ignore cargo.lock file

* Fix hardware invoke + refactor hardware + refactor tests, constants

* use api wrapper in extension to invoke hardware call + api wrapper build integration

* add newline at EOF (per Akarshan)

* add vi mock for getSystemInfo
2025-08-15 08:59:01 +07:00

50 lines
955 B
TypeScript

import { invoke } from '@tauri-apps/api/core'
// Types
export interface CpuStaticInfo {
name: string;
core_count: number;
arch: string;
extensions: string[];
}
export interface GpuInfo {
name: string;
total_memory: number;
vendor: string;
uuid: string;
driver_version: string;
nvidia_info?: any;
vulkan_info?: any;
}
export interface SystemInfo {
cpu: CpuStaticInfo;
os_type: string;
os_name: string;
total_memory: number;
gpus: GpuInfo[];
}
export interface GpuUsage {
uuid: string;
used_memory: number;
total_memory: number;
}
export interface SystemUsage {
cpu: number;
used_memory: number;
total_memory: number;
gpus: GpuUsage[];
}
// Hardware commands
export async function getSystemInfo(): Promise<SystemInfo> {
return await invoke('plugin:hardware|get_system_info');
}
export async function getSystemUsage(): Promise<SystemUsage> {
return await invoke('plugin:hardware|get_system_usage');
}