From c2ea53f2c4e5d718dba0882f844031f36dfb0bac Mon Sep 17 00:00:00 2001 From: Neptune Date: Sat, 9 Nov 2024 19:21:53 -0500 Subject: [PATCH] Remove old libs from ollama for Windows --- screenpipe-app-tauri/scripts/pre_build.js | 28 ++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/screenpipe-app-tauri/scripts/pre_build.js b/screenpipe-app-tauri/scripts/pre_build.js index 7fc94ad21..ee00faa35 100644 --- a/screenpipe-app-tauri/scripts/pre_build.js +++ b/screenpipe-app-tauri/scripts/pre_build.js @@ -535,6 +535,32 @@ async function installOllamaSidecar() { if (platform === 'windows' && await fs.exists('C:\\ollama\\')) { console.log('ollama sidecar already exists. skipping installation.'); await fs.cp('C:\\ollama\\', ollamaDir, { recursive: true }); + // Remove older library versions to save storage + const libDir = path.join(ollamaDir, 'lib', 'ollama'); + const oldLibs = [ + 'cublas64_11.dll', + 'cublasLt64_11.dll', + 'cudart64_110.dll', + 'ggml_cuda_v11.dll', + 'rocblas', + 'rocblas.dll', + 'ggml_rocm.dll' + ]; + + for (const lib of oldLibs) { + try { + const libPath = path.join(libDir, lib); + const stat = await fs.stat(libPath); + if (stat.isDirectory()) { + await fs.rm(libPath, { recursive: true, force: true }); + } else { + await fs.unlink(libPath); + } + console.log(`removed old library: ${lib}`); + } catch (error) { + console.warn(`failed to remove ${lib}:`, error.message); + } + } return; } @@ -632,4 +658,4 @@ if (action?.includes('--build' || action.includes('--dev'))) { } await $`bun install` await $`bunx tauri ${action.includes('--dev') ? 'dev' : 'build'}` -} \ No newline at end of file +}