Restore dependency refresh after install AND persist safe download mode on retries. (#499)

This commit is contained in:
Sanjay Davis
2026-06-01 18:58:06 +05:30
committed by GitHub
parent c38932e6c6
commit 508fabcb3b
2 changed files with 13 additions and 1 deletions

View File

@@ -1794,6 +1794,7 @@ const shared = {
_savePresets,
_copyText,
_persistEnvState,
_refreshDependencies: _fetchDependencies,
_getGpuToggleTotal: () => _gpuToggleTotal,
modelLogo,
esc,

View File

@@ -45,6 +45,7 @@ let _loadPresets;
let _savePresets;
let _copyText;
let _persistEnvState;
let _refreshDependencies;
let modelLogo;
let esc;
let _detectBackend;
@@ -374,6 +375,13 @@ function _updateTask(sessionId, updates) {
}
}
function _refreshDepsAfterInstall(task) {
if (!task || task.type !== 'download' || !task.payload?._dep) return;
try {
_refreshDependencies?.({ host: task.remoteHost || '', port: task.sshPort || '', venv: task.payload?.env_path || '' });
} catch {}
}
export function _removeTask(sessionId) {
_tombstoneTask(sessionId); // so sync/poll can't resurrect it
const tasks = _loadTasks().filter(t => t.sessionId !== sessionId);
@@ -731,7 +739,7 @@ async function _retryDownload(name, payload) {
uiModule.showToast('Download failed: ' + (data.error || ''));
return;
}
_addTask(data.session_id, name, 'download', payload);
_addTask(data.session_id, name, 'download', _payload);
uiModule.showToast(`Downloading ${name}...`);
} catch (e) {
uiModule.showToast('Download failed: ' + e.message);
@@ -1940,6 +1948,7 @@ async function _reconnectTask(el, task) {
const _chk = el.querySelector('.cookbook-task-check'); if (_chk && task.type !== 'download') _chk.style.display = '';
const _sb = el.querySelector('.cookbook-task-serve-btn'); if (_sb) _sb.style.display = '';
_showCookbookNotif();
_refreshDepsAfterInstall(task);
}
}
_renderRunningTab();
@@ -2138,6 +2147,7 @@ async function _reconnectTask(el, task) {
_updateTask(task.sessionId, { status: 'done' });
const _sb2 = el.querySelector('.cookbook-task-serve-btn'); if (_sb2) _sb2.style.display = '';
_showCookbookNotif();
_refreshDepsAfterInstall(task);
fetch('/api/shell/exec', {
method: 'POST', credentials: 'same-origin',
headers: { 'Content-Type': 'application/json' },
@@ -2674,6 +2684,7 @@ export function initRunning(shared) {
_savePresets = shared._savePresets;
_copyText = shared._copyText;
_persistEnvState = shared._persistEnvState;
_refreshDependencies = shared._refreshDependencies;
modelLogo = shared.modelLogo;
esc = shared.esc;
_detectBackend = shared._detectBackend;