Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use preinstalled Ollama for speeding up Windows builds #647

Merged
merged 4 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions screenpipe-app-tauri/scripts/pre_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,15 +443,15 @@ if (platform == 'macos') {
// Setup FFMPEG
if (!(await fs.exists(config.ffmpegRealname))) {
await $`wget --no-config -nc ${config.macos.ffmpegUrl} -O ${config.macos.ffmpegName}.7z`
await $`7z e ${config.macos.ffmpegName}.7z -o ./${config.macos.ffmpegName}`
await $`7z e ${config.macos.ffmpegName}.7z -o${config.macos.ffmpegName}`
await $`mv ${config.macos.ffmpegName} ${config.ffmpegRealname}`
await $`rm ${config.macos.ffmpegName}.7z`
} else {
console.log('FFMPEG already exists');
}

// Move and rename ffmpeg and ffprobe binaries
const ffmpegSrc = path.join(cwd, config.ffmpegRealname, 'bin', 'ffmpeg');
const ffmpegSrc = path.join(cwd, config.ffmpegRealname, 'ffmpeg');

// For x86_64
await fs.copyFile(ffmpegSrc, path.join(cwd, 'ffmpeg-x86_64-apple-darwin'));
Expand All @@ -460,7 +460,6 @@ if (platform == 'macos') {
await fs.copyFile(ffmpegSrc, path.join(cwd, 'ffmpeg-aarch64-apple-darwin'));

console.log('Moved and renamed ffmpeg binary for externalBin');

}


Expand Down Expand Up @@ -523,14 +522,20 @@ async function installOllamaSidecar() {
throw new Error('Unsupported platform');
}


if ((platform === 'macos' && await fs.exists(path.join(ollamaDir, "ollama-aarch64-apple-darwin"))
&& await fs.exists(path.join(ollamaDir, "ollama-x86_64-apple-darwin"))) ||
(platform !== 'macos' && await fs.exists(path.join(ollamaDir, ollamaExe)))) {
console.log('ollama sidecar already exists. skipping installation.');
return;
}

// For our self-hosted runners
if (platform === 'windows' && await fs.exists('C:\\ollama\\')) {
console.log('ollama sidecar already exists. skipping installation.');
await fs.cp('C:\\ollama\\', ollamaDir, {recursive: true});
return;
}

try {
await fs.mkdir(ollamaDir, { recursive: true });
const downloadPath = path.join(ollamaDir, path.basename(ollamaUrl));
Expand Down
2 changes: 1 addition & 1 deletion screenpipe-app-tauri/src-tauri/tauri.windows.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"ollama"
],
"resources": {
"ffmpeg\\bin\\x64\\*": "./",
"ffmpeg\\bin\\*": "./",
"ffmpeg\\lib\\*": "./",
"onnxruntime*\\lib\\*.dll": "./",
"lib\\ollama\\*": "./"
Expand Down
Loading