mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-22 06:28:11 +02:00
Add real-time system stats (CPU/RAM/GPU/VRAM) and fix favicon
Favicon now matches the LokiMark topbar icon instead of an unrelated arrow glyph. New /api/system/stats endpoint (psutil + nvidia-smi) polled every 2s and shown in the topbar next to the Ollama status.
This commit is contained in:
1 parent
b9bccac4ba
commit
ecadf55743
8 files changed
+120
-7
No files matched your search
@@ -6,6 +6,7 @@ import {
|
||||
getModels,
|
||||
getSession,
|
||||
getStatus,
|
||||
getSystemStats,
|
||||
fileContent,
|
||||
listFiles,
|
||||
listSessions,
|
||||
@@ -18,11 +19,13 @@ import {
|
||||
type OllamaModel,
|
||||
type OllamaStatus,
|
||||
type Session,
|
||||
type SystemStats,
|
||||
type ToolCall,
|
||||
} from "../api/client";
|
||||
|
||||
interface LokiState {
|
||||
status: OllamaStatus | null;
|
||||
systemStats: SystemStats | null;
|
||||
models: OllamaModel[];
|
||||
selectedModel: string;
|
||||
loadingModels: boolean;
|
||||
@@ -54,6 +57,7 @@ interface LokiState {
|
||||
openPreview: (path: string) => Promise<void>;
|
||||
setSelectedModel: (name: string) => void;
|
||||
refreshStatus: () => Promise<void>;
|
||||
refreshSystemStats: () => Promise<void>;
|
||||
refreshModels: () => Promise<void>;
|
||||
refreshFiles: () => Promise<void>;
|
||||
|
||||
@@ -69,6 +73,7 @@ let activeStreamController: AbortController | null = null;
|
||||
|
||||
export const useStore = create<LokiState>((set, get) => ({
|
||||
status: null,
|
||||
systemStats: null,
|
||||
models: [],
|
||||
selectedModel: "",
|
||||
loadingModels: false,
|
||||
@@ -154,6 +159,14 @@ export const useStore = create<LokiState>((set, get) => ({
|
||||
}
|
||||
},
|
||||
|
||||
refreshSystemStats: async () => {
|
||||
try {
|
||||
set({ systemStats: await getSystemStats() });
|
||||
} catch {
|
||||
set({ systemStats: null });
|
||||
}
|
||||
},
|
||||
|
||||
refreshModels: async () => {
|
||||
set({ loadingModels: true });
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user