diff --git a/app/frontend/src/components/Generator.jsx b/app/frontend/src/components/Generator.jsx index 8fc9048..c1b2811 100644 --- a/app/frontend/src/components/Generator.jsx +++ b/app/frontend/src/components/Generator.jsx @@ -139,7 +139,7 @@ function Generator({ crashError = status.error; break; } - if (!status.running && i > 3) { + if (!status.running && !status.loading?.active && i > 3) { crashError = "The backend process terminated immediately on startup."; break; } diff --git a/app/frontend/src/components/ImageConstraints.jsx b/app/frontend/src/components/ImageConstraints.jsx index 5f23b0d..ecb9ce9 100644 --- a/app/frontend/src/components/ImageConstraints.jsx +++ b/app/frontend/src/components/ImageConstraints.jsx @@ -86,18 +86,17 @@ function ImageConstraints({ const currentBackend = constraints.backendType || "cpu"; if (backendType === currentBackend) return; - const isGpuBackend = (type) => !["cpu", "openvino-npu"].includes(type); const switchesAccelerator = - (currentBackend === "openvino-npu" && isGpuBackend(backendType)) || - (isGpuBackend(currentBackend) && backendType === "openvino-npu"); + (currentBackend === "openvino-npu" && backendType !== "openvino-npu") || + (currentBackend !== "openvino-npu" && backendType === "openvino-npu"); if (serverRunning && switchesAccelerator) { const leavingNpu = currentBackend === "openvino-npu"; const confirmed = await showConfirm({ - title: leavingNpu ? "Unload NPU Model?" : "Unload GPU Model?", + title: leavingNpu ? "Unload NPU Model?" : "Unload Model?", message: leavingNpu - ? "The OpenVINO NPU model must be unloaded before switching to the GPU backend." - : "The GPU model must be unloaded before switching to the OpenVINO NPU backend.", + ? "The OpenVINO NPU model must be unloaded before switching to the standard backend." + : "The active model must be unloaded before switching to the OpenVINO NPU backend.", confirmLabel: "Unload", cancelLabel: "Cancel", danger: true, diff --git a/app/frontend/src/components/ModelManager.jsx b/app/frontend/src/components/ModelManager.jsx index bb78cc1..179de5b 100644 --- a/app/frontend/src/components/ModelManager.jsx +++ b/app/frontend/src/components/ModelManager.jsx @@ -332,7 +332,9 @@ function ModelManager({ activeModel, setActiveModel, serverRunning, setServerRun let isReady = false; let crashError = null; - for (let i = 0; i < 240; i++) { // Poll for up to 120 seconds (240 * 500ms) + const isOpenVinoModel = modelInfo?.backendType === "openvino-npu"; + const maxStartupPolls = isOpenVinoModel ? 1200 : 240; + for (let i = 0; i < maxStartupPolls; i++) { const status = await getBackendStatus(); if (status.loading) { setModelLoadProgress({ @@ -355,7 +357,7 @@ function ModelManager({ activeModel, setActiveModel, serverRunning, setServerRun crashError = status.error; break; } - if (!status.running && i > 3) { + if (!status.running && !status.loading?.active && i > 3) { crashError = "The backend process terminated immediately on startup."; break; } diff --git a/scripts/__pycache__/openvino_npu_worker.cpython-313.pyc b/scripts/__pycache__/openvino_npu_worker.cpython-313.pyc index 4ca397f..0d8ccd3 100644 Binary files a/scripts/__pycache__/openvino_npu_worker.cpython-313.pyc and b/scripts/__pycache__/openvino_npu_worker.cpython-313.pyc differ