@hyperwindmill/caretaker-cli 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18545,6 +18545,7 @@ ${text}</tr>
18545
18545
  // src/VoiceTab.tsx
18546
18546
  var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
18547
18547
  var BACKEND_POLL_MS = 1e4;
18548
+ var CONFIRM_DELETE_MS = 4e3;
18548
18549
  var EMPTY = { enabled: false, endpoint: "", sttModel: "" };
18549
18550
  var LOCAL_DEFAULTS = {
18550
18551
  endpoint: "http://127.0.0.1:8969/v1",
@@ -18581,6 +18582,24 @@ ${text}</tr>
18581
18582
  const [backendBusy, setBackendBusy] = (0, import_react12.useState)(false);
18582
18583
  const [backendProgress, setBackendProgress] = (0, import_react12.useState)(null);
18583
18584
  const [backendError, setBackendError] = (0, import_react12.useState)(null);
18585
+ const [confirmingDelete, setConfirmingDelete] = (0, import_react12.useState)(false);
18586
+ const confirmDeleteTimer = (0, import_react12.useRef)(null);
18587
+ const disarmDelete = () => {
18588
+ if (confirmDeleteTimer.current) clearTimeout(confirmDeleteTimer.current);
18589
+ confirmDeleteTimer.current = null;
18590
+ setConfirmingDelete(false);
18591
+ };
18592
+ const armDelete = () => {
18593
+ if (confirmDeleteTimer.current) clearTimeout(confirmDeleteTimer.current);
18594
+ setConfirmingDelete(true);
18595
+ confirmDeleteTimer.current = setTimeout(() => setConfirmingDelete(false), CONFIRM_DELETE_MS);
18596
+ };
18597
+ (0, import_react12.useEffect)(
18598
+ () => () => {
18599
+ if (confirmDeleteTimer.current) clearTimeout(confirmDeleteTimer.current);
18600
+ },
18601
+ []
18602
+ );
18584
18603
  const lastContainer = (0, import_react12.useRef)(null);
18585
18604
  const adoptBackendStatus = (status) => {
18586
18605
  lastContainer.current = status.container;
@@ -18660,6 +18679,20 @@ ${text}</tr>
18660
18679
  fetchBackendStatus();
18661
18680
  }
18662
18681
  };
18682
+ const deleteBackend = async () => {
18683
+ disarmDelete();
18684
+ setBackendBusy(true);
18685
+ setBackendError(null);
18686
+ try {
18687
+ const res = await fetch("/api/voice/backend/delete", { method: "POST" });
18688
+ if (res.ok) adoptBackendStatus(await res.json());
18689
+ else setBackendError(await res.text().catch(() => "") || "Delete failed.");
18690
+ } catch {
18691
+ } finally {
18692
+ setBackendBusy(false);
18693
+ fetchBackendStatus();
18694
+ }
18695
+ };
18663
18696
  (0, import_react12.useEffect)(() => {
18664
18697
  if (catalogResult) setFetching(false);
18665
18698
  }, [catalogResult]);
@@ -18729,7 +18762,16 @@ ${text}</tr>
18729
18762
  showBackendBlock && backendStatus && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18730
18763
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "voice-backend-status", children: [
18731
18764
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: backendProgress ?? backendStatusText(backendStatus) }),
18732
- backendStatus.container === "running" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: stopBackend, disabled: backendBusy, children: backendBusy ? "Stopping\u2026" : "Stop" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: startBackend, disabled: backendBusy, children: backendBusy ? "Starting\u2026" : "Start" })
18765
+ backendStatus.container === "running" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: stopBackend, disabled: backendBusy, children: backendBusy ? "Stopping\u2026" : "Stop" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: startBackend, disabled: backendBusy, children: backendBusy ? "Starting\u2026" : "Start" }),
18766
+ backendStatus.container !== "absent" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18767
+ "button",
18768
+ {
18769
+ type: "button",
18770
+ onClick: confirmingDelete ? deleteBackend : armDelete,
18771
+ disabled: backendBusy,
18772
+ children: confirmingDelete ? "Really delete?" : "Delete"
18773
+ }
18774
+ )
18733
18775
  ] }),
18734
18776
  backendError && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { className: "form-error", children: backendError }),
18735
18777
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "form-group form-group--checkbox", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { htmlFor: "voice-backend-autostart", children: [
@@ -18744,7 +18786,7 @@ ${text}</tr>
18744
18786
  ),
18745
18787
  "Start automatically with caretaker"
18746
18788
  ] }) }),
18747
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: "The first start downloads about 2 GB. The container publishes on the port in your endpoint \u2014 if that port is taken, change it there and save; caretaker never picks a port for you." })
18789
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("small", { children: "The first start downloads about 2 GB. The container publishes on the port in your endpoint \u2014 if that port is taken, change it there and save; caretaker never picks a port for you. Delete removes the container but keeps the downloaded models \u2014 try it when the backend misbehaves after switching networks." })
18748
18790
  ] }),
18749
18791
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "form-group form-group--checkbox", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { htmlFor: "voice-enabled", children: [
18750
18792
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
@@ -19087,7 +19129,7 @@ ${text}</tr>
19087
19129
  children: "Scheduler"
19088
19130
  }
19089
19131
  ),
19090
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19132
+ layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19091
19133
  "button",
19092
19134
  {
19093
19135
  className: `settings-panel__tab-btn ${activeTab === "voice" ? "settings-panel__tab-btn--active" : ""}`,