diff --git a/invokeai/app/api/routers/app_info.py b/invokeai/app/api/routers/app_info.py index 9e063e9dcd..75ec6e0623 100644 --- a/invokeai/app/api/routers/app_info.py +++ b/invokeai/app/api/routers/app_info.py @@ -188,9 +188,5 @@ async def get_invocation_cache_status() -> InvocationCacheStatus: @app_router.get("/system-stats", operation_id="get_system_stats", status_code=200, response_model=SystemStats) async def get_stats() -> SystemStats: """Fetches and returns the system statistics, including CPU, RAM, and GPU stats.""" - try: - stats = get_system_stats() - return stats - except Exception as e: - print(f"Error fetching system stats: {e}") - return SystemStats(cpu_usage=0.0, ram_usage=0.0, gpu_usage=[]) + stats = get_system_stats() + return stats diff --git a/invokeai/frontend/web/src/services/api/endpoints/appInfo.ts b/invokeai/frontend/web/src/services/api/endpoints/appInfo.ts index a28e3321aa..bcc607b399 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/appInfo.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/appInfo.ts @@ -1,23 +1,10 @@ import { $openAPISchemaUrl } from 'app/store/nanostores/openAPISchemaUrl'; import type { OpenAPIV3_1 } from 'openapi-types'; import type { paths } from 'services/api/schema'; -import type { AppConfig, AppDependencyVersions, AppVersion } from 'services/api/types'; +import type { AppConfig, AppDependencyVersions, AppVersion, SystemStats } from 'services/api/types'; import { api, buildV1Url } from '..'; -interface GPUStat { - id: number; - load: number; - memory: number; - memory_total: number; -} - -interface SystemStats { - cpu_usage: number; - ram_usage: number; - gpu_usage: GPUStat[]; -} - /** * Builds an endpoint URL for the app router * @example diff --git a/invokeai/frontend/web/src/services/api/types.ts b/invokeai/frontend/web/src/services/api/types.ts index 647f141f4f..7981d1c419 100644 --- a/invokeai/frontend/web/src/services/api/types.ts +++ b/invokeai/frontend/web/src/services/api/types.ts @@ -237,3 +237,17 @@ export type PostUploadAction = | RGIPAdapterImagePostUploadAction | UpscaleInitialImageAction | ReplaceLayerWithImagePostUploadAction; + +// System Stats +export interface GPUStat { + id: number; + load: number; + memory: number; + memory_total: number; +} + +export interface SystemStats { + cpu_usage: number; + ram_usage: number; + gpu_usage: GPUStat[]; +}