Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Scaffold

Manav Rathi1e720b4b7d70
diff --git a/desktop/src/main/services/ml-util-test.ts b/desktop/src/main/services/ml-util-test.ts
new file mode 100644
index 0000000000..684b782c4b
--- /dev/null
+++ b/desktop/src/main/services/ml-util-test.ts
@@ -0,0 +1,10 @@
+console.log("in utility process");
+
+process.parentPort.once("message", (e) => {
+ console.log("got message in utility process", e);
+ const [port] = e.ports;
+
+ port?.on("message", (e2) => {
+ console.log("got message on port in utility process", e2);
+ });
+});
diff --git a/desktop/src/main/services/ml.ts b/desktop/src/main/services/ml.ts
index a6407e55c4..d7ea06caec 100644
--- a/desktop/src/main/services/ml.ts
+++ b/desktop/src/main/services/ml.ts
@@ -62,7 +62,7 @@ import { utilityProcess } from "electron/main";
export const createMLSession = () => {
const { port1, port2 } = new MessageChannelMain();
- const child = utilityProcess.fork("./ml-utility");
+ const child = utilityProcess.fork("./ml-util-test");
child.postMessage(/* unused */ "", [port1]);
ipcRenderer.postMessage("ml-session-port", /* unused */ "", [port2]);
diff --git a/web/packages/base/types/ipc.ts b/web/packages/base/types/ipc.ts
index 7a11553835..ebf2670da2 100644
--- a/web/packages/base/types/ipc.ts
+++ b/web/packages/base/types/ipc.ts
@@ -334,6 +334,17 @@ export interface Electron {
// - ML
+ /**
+ * Create a new ML session.
+ *
+ * This creates a new Node.js utility process, and sets things up so that we
+ * can communicate directly with that utility process using a
+ * {@link MessagePort} we get back.
+ *
+ * For more details about the IPC flow, see: [Note: ML IPC].
+ */
+ createMLSession: () => Promise<MessagePort>;
+
/**
* Return a CLIP embedding of the given image.
*