Reduce cookbook startup polling

This commit is contained in:
pewdiepie-archdaemon
2026-06-27 13:50:21 +00:00
parent 45ee5a71f4
commit 4222039b67
6 changed files with 66 additions and 26 deletions
+9 -1
View File
@@ -3663,9 +3663,10 @@ function _renderCachedModelsData(list, data, host) {
_rerenderCachedModels();
}
export async function _fetchCachedModels(fresh = false) {
export async function _fetchCachedModels(fresh = false, opts = {}) {
const list = document.getElementById('hwfit-cached-list');
if (!list) return;
const allowNetwork = fresh || opts.allowNetwork !== false;
list.innerHTML = '';
const _dlWp = spinnerModule.createWhirlpool(22);
@@ -3740,6 +3741,13 @@ export async function _fetchCachedModels(fresh = false) {
_renderCachedModelsData(list, cached, host);
return;
}
if (!allowNetwork) {
_dlWp.destroy();
list.innerHTML = '<div class="hwfit-loading" style="flex-direction:column;gap:6px;text-align:center;"><div>No cached model scan yet</div><div style="font-size:11px;opacity:0.55;max-width:420px;line-height:1.4;">Press Scan to check this server\'s model cache.</div></div>';
const tagContainer = document.getElementById('serve-tags');
if (tagContainer) tagContainer.innerHTML = '';
return;
}
const res = await fetch(`/api/model/cached${params}`);
if (!res.ok) {
const body = await res.text().catch(() => '');