• Implemented global offline mode for all HuggingFace-dependent modules to eliminate unauthenticated request warnings and prevent external connection attempts during startup and runtime.

   Changes
   • Global Offline Configuration: Added HF_HUB_OFFLINE=1 and TRANSFORMERS_OFFLINE=1 to the environment variables at the top of edit_api.py, embeddings.py, watcher.py, and pose_llm/pose_llm_api.py.
   • Explicit Local Files Only: Updated all huggingface_hub.hf_hub_download calls in edit_api.py to include local_files_only=True, ensuring they never attempt to reach the Hub if models are already cached.
   • LLM Service Optimization: Updated AutoTokenizer and AutoModelForCausalLM calls in pose_llm/pose_llm_api.py to use local_files_only=True.
   • Consistency: Ensured that shared modules like embeddings.py which uses open_clip are also locked to offline mode to prevent background downloads.
This commit is contained in:
mike
2026-06-28 13:12:05 +02:00
parent 30dcb10727
commit 684a4805d7
5 changed files with 126 additions and 47 deletions

View File

@@ -2299,6 +2299,25 @@
// --- HYDRATION_START ---
const PRELOADED_IMAGES = [
"_turntable/up_c8be3aa7/views/view_018_270deg.png",
"_turntable/up_c8be3aa7/views/view_017_255deg.png",
"_turntable/up_c8be3aa7/views/view_016_240deg.png",
"_turntable/up_c8be3aa7/views/view_015_225deg.png",
"_turntable/up_c8be3aa7/views/view_014_210deg.png",
"_turntable/up_c8be3aa7/views/view_013_195deg.png",
"_turntable/up_c8be3aa7/views/view_012_180deg.png",
"_turntable/up_c8be3aa7/views/view_011_165deg.png",
"_turntable/up_c8be3aa7/views/view_010_150deg.png",
"_turntable/up_c8be3aa7/views/view_009_135deg.png",
"_turntable/up_c8be3aa7/views/view_008_120deg.png",
"_turntable/up_c8be3aa7/views/view_007_105deg.png",
"_turntable/up_c8be3aa7/views/view_006_090deg.png",
"_turntable/up_c8be3aa7/views/view_005_075deg.png",
"_turntable/up_c8be3aa7/views/view_004_060deg.png",
"_turntable/up_c8be3aa7/views/view_003_045deg.png",
"_turntable/up_c8be3aa7/views/view_002_030deg.png",
"_turntable/up_c8be3aa7/views/view_001_015deg.png",
"_turntable/up_c8be3aa7/views/view_000_000deg.png",
"up_b8c61991_face.png",
"_turntable/bb_01.png/views/view_008_120deg.png",
"_turntable/bb_01.png/views/view_007_105deg.png",
@@ -2789,8 +2808,6 @@
"20260627_203054_Screenshot_From_2026-06-27_20-04-11.png",
"20260627_203044_image.png",
"20260627_203032_image.png",
"_turntable/up_c8be3aa7/views/view_002_030deg.png",
"_turntable/up_c8be3aa7/views/view_003_045deg.png",
"20260627_201807_12_20260627_201343_image.png",
"20260627_201753_Screenshot_From_2026-06-27_12-32-39.png",
"20260627_201751_11_20260627_201343_image.png",
@@ -2807,18 +2824,12 @@
"20260627_201418_1_20260627_201343_image.png",
"20260627_201400_0_20260627_201343_image.png",
"20260627_201343_image.png",
"_turntable/up_c8be3aa7/views/view_007_105deg.png",
"_turntable/up_c8be3aa7/views/view_006_090deg.png",
"_turntable/up_c8be3aa7/views/view_005_075deg.png",
"_turntable/up_c8be3aa7/views/view_004_060deg.png",
"_turntable/up_c8be3aa7/views/view_001_015deg.png",
"20260627_200711_11_20260627_200330_image.png",
"20260627_200506_image.png",
"20260627_200422_2_20260627_200330_image.png",
"20260627_200414_image.png",
"20260627_200405_1_20260627_200330_image.png",
"20260627_200330_image.png",
"_turntable/up_c8be3aa7/views/view_000_000deg.png",
"20260627_200201_12_20260627_195835_image.png",
"20260627_200144_11_20260627_195835_image.png",
"20260627_200127_10_20260627_195835_image.png",
@@ -7497,18 +7508,35 @@
_lastSelectedGid = gid;
localStorage.setItem('lastSelectedGid', gid);
_activeFilmstripTab = 'group';
['Group', 'Hidden', 'Source', 'Archived'].forEach(t => {
// Default to 'active' tab, but fallback to 'group' if empty
const activeNames = data.names.filter(name => !fileHidden[name] && !fileIsSource[name] && !fileArchived[name]);
if (activeNames.length > 0) {
_activeFilmstripTab = 'active';
lbNames = activeNames;
lbUrls = activeNames.map(n => IMAGE_FOLDER + n);
} else {
_activeFilmstripTab = 'group';
lbUrls = data.urls;
lbNames = data.names;
}
['Active', 'Group', 'Hidden', 'Source', 'Archived'].forEach(t => {
const el = document.getElementById(`fsTab${t}`);
if (el) el.classList.toggle('active', t.toLowerCase() === 'group');
if (el) el.classList.toggle('active', t.toLowerCase() === _activeFilmstripTab);
});
_multiSelectModeActive = false;
_selectedFilenames.clear();
updateMultiSelectUI();
lbUrls = data.urls;
lbNames = data.names;
lbIdx = startIdx !== undefined ? startIdx : (cycleIdx.get(gid) || 0);
// If we are in 'active' tab, ensure lbIdx is valid for lbNames
if (_activeFilmstripTab === 'active' && startIdx !== undefined) {
const targetName = data.names[startIdx];
const activeIdx = lbNames.indexOf(targetName);
if (activeIdx !== -1) lbIdx = activeIdx;
else lbIdx = 0; // fallback if the image we clicked is not 'active'
}
updateStudio();
document.getElementById('studio').classList.add('open');
// Hide main page scrollbar — nothing in studio scrolls the page
@@ -9808,14 +9836,22 @@
const r = await fetch(`${API}/output/_data/system_status.json?t=${Date.now()}`, { signal: AbortSignal.timeout(2000) });
if (!r.ok) return;
const data = await r.json();
if (data.locked && !_lastSystemLockState) {
_lastSystemLockState = true;
if (data.locked) {
if (!privacyMode) togglePrivacyMode();
showPrivacyOverlay();
console.log("[privacy] System lock detected, auto-hiding content");
showToast('Privacy lock active (System Locked)', 'info');
} else if (!data.locked) {
_lastSystemLockState = false;
if (!_lastSystemLockState) {
_lastSystemLockState = true;
console.log("[privacy] System lock detected, auto-hiding content");
showToast('Privacy lock active (System Locked)', 'info');
}
} else {
if (_lastSystemLockState) {
_lastSystemLockState = false;
// If it was locked by system, and now system is unlocked,
// we automatically unlock if privacyMode is still active.
if (privacyMode) togglePrivacyMode();
console.log("[privacy] System unlock detected, restoring content");
}
}
} catch (e) {}
}