Self-hosted AI workspace.
Python
Restore dependency refresh after install AND persist safe download mode on retries. (#499)
Sanjay Davis6faccc7b97c8
diff --git a/static/js/cookbook.js b/static/js/cookbook.jsindex 1fd172ca0..1a3cec72f 100644--- a/static/js/cookbook.js+++ b/static/js/cookbook.js@@ -1794,6 +1794,7 @@ const shared = {_savePresets,_copyText,_persistEnvState,+ _refreshDependencies: _fetchDependencies,_getGpuToggleTotal: () => _gpuToggleTotal,modelLogo,esc,diff --git a/static/js/cookbookRunning.js b/static/js/cookbookRunning.jsindex f88333a02..3f8e591f6 100644--- a/static/js/cookbookRunning.js+++ b/static/js/cookbookRunning.js@@ -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 itconst 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;