Fix compatibility with SD WebUI Forge (#60):

* Ignore missing repo info
* Account for bar spacing in sparkline bar graph config calculation
pull/61/head
Athari 2026-01-27 01:40:13 +03:00
parent 9942ea11aa
commit 35054070b2
2 changed files with 16 additions and 13 deletions

View File

@ -21,7 +21,7 @@ const colorRangeMap = $.range_map({
'81:90': '#7c2d12',
'91:100': '#6c2e12',
});
const sparklineConfig = { type: 'bar', height: '100px', barWidth: '3px', barSpacing: '1px', disableInteraction: true, chartRangeMin: 0, chartRangeMax: 100, disableHiddenCheck: true, colorMap: colorRangeMap, fillColor: false };
const sparklineConfig = { type: 'bar', height: '100px', barWidth: 3, barSpacing: 1, disableInteraction: true, chartRangeMin: 0, chartRangeMax: 100, disableHiddenCheck: true, colorMap: colorRangeMap, fillColor: false };
function refresh_info() {
const btn = gradioApp().getElementById('system_info_tab_refresh_btn'); // we could cache this dom element
@ -44,7 +44,7 @@ function receive_system_info(data) {
loadData.push(data?.memory?.utilization || 0);
const tab = gradioApp().getElementById('tab_system') || gradioApp().getElementById('tabs');
if (!tab) return;
sparklineConfig.barWidth = Math.floor(tab.clientWidth - 20) / data_length / 2;
sparklineConfig.barWidth = Math.max(1, Math.floor(tab.clientWidth - 20) / data_length / 2 - sparklineConfig.barSpacing);
$('#si-sparkline-load').sparkline(loadData, sparklineConfig);
if (memoData.length > data_length) memoData.shift();

View File

@ -245,6 +245,7 @@ def get_libs():
def get_repos():
try:
repos = {}
for key, val in paths.paths.items():
try:
@ -256,6 +257,8 @@ def get_repos():
except Exception:
repos[key] = '(unknown)'
return repos
except Exception as e:
return { 'error': e }
def get_platform():