From 64687545eeba7c56acceda03c86b6679c99cf260 Mon Sep 17 00:00:00 2001 From: menno Date: Tue, 8 Jul 2025 22:49:10 +0200 Subject: [PATCH] feat: add getSystemStats method to retrieve system statistics --- lib/src/_http_endpoints.dart | 7 +++++++ lib/src/comfyui_api.dart | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/lib/src/_http_endpoints.dart b/lib/src/_http_endpoints.dart index 7e20e94..49435da 100644 --- a/lib/src/_http_endpoints.dart +++ b/lib/src/_http_endpoints.dart @@ -160,6 +160,13 @@ class ComfyApiHttpEndpoints { return jsonDecode(response.body); } + /// Gets system stats, including OS, Python version, etc. + Future> getSystemStats() async { + final response = await _httpClient.get(Uri.parse('$host/system_stats')); + _validateResponse(response); + return jsonDecode(response.body); + } + /// Gets a list of possible samplers from the object info Future> getKSamplers() async { final objectInfo = await getObjectInfo(); diff --git a/lib/src/comfyui_api.dart b/lib/src/comfyui_api.dart index 251eba1..cb7f73b 100644 --- a/lib/src/comfyui_api.dart +++ b/lib/src/comfyui_api.dart @@ -143,6 +143,10 @@ class ComfyUiApi { Future> getObjectInfo() => _httpEndpoints.getObjectInfo(); + /// Gets system stats from the server + Future> getSystemStats() => + _httpEndpoints.getSystemStats(); + /// Gets a list of possible samplers from the object info Future> getKSamplers() => _httpEndpoints.getKSamplers();