Skip to content

Commit

Permalink
- fix: ollama version empty when client and server version are equal (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
agallardol authored Nov 11, 2024
1 parent 12fd3a3 commit 92c9cec
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-ci-healchecks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
env:
ARCH: x86_64-unknown-linux-gnu
SHINKAI_NODE_VERSION: v0.8.14
OLLAMA_VERSION: v0.4.0
OLLAMA_VERSION: v0.4.1
run: |
npx ts-node ./ci-scripts/download-side-binaries.ts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ jobs:
env:
ARCH: ${{ matrix.arch }}
SHINKAI_NODE_VERSION: v0.8.14
OLLAMA_VERSION: v0.4.0
OLLAMA_VERSION: v0.4.1
run: |
npx ts-node ./ci-scripts/download-side-binaries.ts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ jobs:
env:
ARCH: ${{ matrix.arch }}
SHINKAI_NODE_VERSION: v0.8.14
OLLAMA_VERSION: v0.4.0
OLLAMA_VERSION: v0.4.1
run: |
npx ts-node ./ci-scripts/download-side-binaries.ts
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ $ git clone https://github.com/dcSpark/shinkai-apps
#### Macos
```
ARCH="aarch64-apple-darwin" \
OLLAMA_VERSION="v0.4.0" \
OLLAMA_VERSION="v0.4.1" \
SHINKAI_NODE_VERSION="v0.8.14" \
npx ts-node ./ci-scripts/download-side-binaries.ts
```

#### Linux
```
ARCH="x86_64-unknown-linux-gnu" \
OLLAMA_VERSION="v0.4.0"\
OLLAMA_VERSION="v0.4.1"\
SHINKAI_NODE_VERSION="v0.8.14" \
npx ts-node ./ci-scripts/download-side-binaries.ts
```

#### Windows
```
$ENV:OLLAMA_VERSION="v0.4.0"
$ENV:OLLAMA_VERSION="v0.4.1"
$ENV:SHINKAI_NODE_VERSION="v0.8.14"
$ENV:ARCH="x86_64-pc-windows-msvc"
npx ts-node ./ci-scripts/download-side-binaries.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,28 @@ impl OllamaProcessHandler {
let stdout = String::from_utf8_lossy(&output.stdout);
log::info!("capturing ollama version from stdout: {:?}", stdout);

/*
'client version is *.*.*' is the real ollam version our app is running BUT
- when embedded and local ollama are equal the message says 'ollama version is *.*.*'
- when embedded and local are different, the message says 'ollama version is *.*.*... \nWarning client version is *.*.*'
So we try to find the client version and if it doesn't exists we fallback to ollama version (that means client and local are equals)
*/
let re = Regex::new(r"client version is (\S+)").unwrap();
let version = re
let mut version = re
.captures(&stdout)
.and_then(|cap| cap.get(1))
.map(|m| m.as_str())
.unwrap_or("");

if version.is_empty() {
let re = Regex::new(r"ollama version is (\S+)").unwrap();
version = re
.captures(&stdout)
.and_then(|cap| cap.get(1))
.map(|m| m.as_str())
.unwrap_or("");
}
log::info!("ollama version {}", version);

Ok(version.to_string())
Expand Down
5 changes: 1 addition & 4 deletions ci-scripts/download-side-binaries.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { exec } from 'child_process';
import { createWriteStream, existsSync } from 'fs';
import { createWriteStream } from 'fs';
import path from 'path';
import axios from 'axios';
import { ensureFile } from 'fs-extra';
Expand Down Expand Up @@ -46,9 +46,6 @@ const addExecPermissions = (path: string) => {
};

const downloadFile = async (url: string, path: string): Promise<void> => {
if (existsSync(path)) {
return Promise.resolve();
}
console.log(`Downloading ${url}`);
const response = await axios({
method: 'GET',
Expand Down

0 comments on commit 92c9cec

Please sign in to comment.