Skip to content

Commit

Permalink
Fixes for the local model install
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas101 committed Nov 7, 2024
1 parent 56bdd9e commit 8c861ce
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/native/main/Installer/Installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,23 @@ 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}`)
}
}

// 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}`)
}
Expand Down

0 comments on commit 8c861ce

Please sign in to comment.