Open zpar-ky opened 1 month ago
To resolve the issue with downloading Ollama on Windows, update the downloadOllama.js
script to handle the new zip format for Windows binaries. Here are the specific steps:
Modify the binariesInfo
object in scripts/downloadOllama.js
to point to the zip file:
win32: {
url: "https://github.com/ollama/ollama/releases/download/v0.1.48/ollama-windows-amd64.zip",
path: "../binaries/win32/ollama-windows-amd64.zip",
},
Update the downloadIfMissing
function to extract the zip file after downloading:
const unzip = require('unzipper');
function downloadIfMissing(platformKey) { const info = binariesInfo[platformKey]; const filePath = path.join(__dirname, info.path); ensureDirectoryExistence(filePath);
fs.access(filePath, fs.constants.F_OK, (err) => {
if (err) {
console.log(Downloading ${platformKey} Ollama binary...
);
const request = https.get(info.url, (response) => {
if (response.statusCode === 200) {
const file = fs.createWriteStream(filePath);
response.pipe(file);
file.on('finish', () => {
file.close(async () => {
console.log(Downloaded ${platformKey} Ollama binary.
);
if (platformKey === 'win32') {
await fs.createReadStream(filePath).pipe(unzip.Extract({ path: path.dirname(filePath) }));
fs.unlinkSync(filePath); // Remove the zip file after extraction
} else {
setExecutable(filePath);
}
});
});
} else if (response.statusCode === 302 || response.statusCode === 301) {
console.log(Redirection to ${response.headers.location}
);
binariesInfo[platformKey].url = response.headers.location;
downloadIfMissing(platformKey);
} else {
console.error(Failed to download ${platformKey} binary. Status code: ${response.statusCode}
);
}
});
request.on('error', (error) => {
console.error(Error downloading ${platformKey} binary: ${error.message}
);
});
} else {
console.log(${platformKey} Ollama binary already exists.
);
if (platformKey !== 'win32') {
setExecutable(filePath);
}
}
});
}
3. Ensure the `OllamaService` in `electron/main/llm/models/Ollama.ts` correctly references the extracted executable path for Windows:
```javascript
case 'win32':
exeName = 'ollama-windows-amd64.exe';
exeDir = app.isPackaged
? path.join(process.resourcesPath, 'binaries')
: path.join(app.getAppPath(), 'binaries', 'win32');
break;
These changes should address the issue with downloading and extracting the Ollama binary on Windows.
/scripts/downloadOllama.js /electron/main/llm/models/Ollama.ts /electron/main/index.ts
Is that an AI written response or a known issue at the moment lol
It's an AI. I am not using Windows, sorry I can't help you with that...
Describe the bug downloadOllama.js windows absolute url 404's.
To Reproduce
I don't expect the following to work either, but here's what I get when trying to add a local llm:
cursory investigation leads me to the downloadOllama script and it looks for a exe but ollama switched to serving zips at some point for windows.
I downloaded the zip manually and tossed the contents in resources/binaries and things appear to be working. I renamed the exe to
ollama-windows-amd64.exe
.Desktop (please complete the following information):