From 8c861ce29452b61b51ede9342508dc2c330b76d7 Mon Sep 17 00:00:00 2001 From: Thomas Beverley Date: Thu, 7 Nov 2024 10:30:31 +0000 Subject: [PATCH] Fixes for the local model install --- src/native/main/Installer/Installer.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/native/main/Installer/Installer.ts b/src/native/main/Installer/Installer.ts index 0c7446f..e4876f4 100644 --- a/src/native/main/Installer/Installer.ts +++ b/src/native/main/Installer/Installer.ts @@ -67,7 +67,15 @@ export async function installLocalModel (rawModelPath: string) { try { const assetPath = AIModelFileSystem.getAssetPath(id) await fs.ensureDir(path.dirname(assetPath)) - await fs.move(path.join(path.dirname(modelPath), sanitizeFilename(id)), assetPath) + switch (process.platform) { + case 'darwin': + // When extracted as part of the pkg installer, we can't move the file only copy it + await fs.copy(path.join(path.dirname(modelPath), sanitizeFilename(id)), assetPath, { overwrite: true }) + break + default: + await fs.move(path.join(path.dirname(modelPath), sanitizeFilename(id)), assetPath) + break + } } catch (ex) { throw new Error(`Failed to install asset ${id}`) } @@ -75,7 +83,7 @@ export async function installLocalModel (rawModelPath: string) { // Write the manifest await AIModelFileSystem.writeModelManifest(modelManifest) - Logger.log(`Installed model: ${rawModelPath}`) + Logger.log(`Installed model: ${modelManifest.id}`) } catch (ex) { Logger.error(`Failed to install model: ${ex.message}`) }