Skip to content

Commit

Permalink
- feature: add ollama repository (#403)
Browse files Browse the repository at this point in the history
* WIP

* WIP: add recommended models cards

* WIP

* WIP

* - feature: added search, pulling memory, filtered models for ollama repository

* - improve: bump ollama v0.3.4

* - fix: added missing logic about installed models

* - feature: add download ollama repository to CI

* - ci: version bump to v0.7.30

* - fix: missing recommended label in models repository

* - fix: several UI/UX fixes

* - fix: add missing translations

* - fix: dynamic tag image on audit

* - fix: security issues with vite-plugin-dts

* - fix: checkout action
  • Loading branch information
agallardol authored Aug 8, 2024
1 parent 0ac50dd commit ac7e864
Show file tree
Hide file tree
Showing 34 changed files with 22,111 additions and 1,123 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ on:

jobs:
node-npm:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Audit
# must use login shell (-l) to have nvm preinstalled, -e exits shell on nonzero exit codes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-ci-healchecks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
env:
ARCH: x86_64-unknown-linux-gnu
SHINKAI_NODE_VERSION: v0.7.28
OLLAMA_VERSION: v0.3.3
OLLAMA_VERSION: v0.3.4
run: |
npx ts-node ./ci-scripts/download-side-binaries.ts
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,14 @@ jobs:
env:
ARCH: ${{ matrix.arch }}
SHINKAI_NODE_VERSION: v0.7.28
OLLAMA_VERSION: v0.3.3
OLLAMA_VERSION: v0.3.4
run: |
npx ts-node ./ci-scripts/download-side-binaries.ts
- name: Download ollama repository
run: |
npx ts-node ./ci-scripts/generate-ollama-models-repository.ts
- name: Adapt package version
run: |
npm version ${{ needs.prebuild.outputs.version }}${{ github.run_number }} --git-tag-version false
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/release-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,14 @@ jobs:
env:
ARCH: ${{ matrix.arch }}
SHINKAI_NODE_VERSION: v0.7.28
OLLAMA_VERSION: v0.3.3
OLLAMA_VERSION: v0.3.4
run: |
npx ts-node ./ci-scripts/download-side-binaries.ts
- name: Download ollama repository
run: |
npx ts-node ./ci-scripts/generate-ollama-models-repository.ts
- name: (Linux) Run NX build on shinkai-desktop
if: ${{ matrix.arch == 'x86_64-unknown-linux-gnu' }}
run: npx nx build shinkai-desktop --skip-nx-cache
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ $ git clone https://github.com/dcSpark/shinkai-apps
#### Macos
```
ARCH="aarch64-apple-darwin" \
OLLAMA_VERSION="v0.3.3" \
OLLAMA_VERSION="v0.3.4" \
SHINKAI_NODE_VERSION="v0.7.28" \
npx ts-node ./ci-scripts/download-side-binaries.ts
```

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

#### Windows
```
$ENV:OLLAMA_VERSION="v0.3.3"
$ENV:OLLAMA_VERSION="v0.3.4"
$ENV:SHINKAI_NODE_VERSION="v0.7.28"
$ENV:ARCH="x86_64-pc-windows-msvc"
npx ts-node ./ci-scripts/download-side-binaries.ts
Expand Down
1 change: 0 additions & 1 deletion apps/shinkai-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
"typescript": "^5.3.2",
"url-loader": "^4.1.1",
"vite": "^4.5.2",
"vite-plugin-dts": "^2.3.0",
"vite-plugin-top-level-await": "^1.3.1",
"vite-plugin-wasm": "^3.2.2",
"vite-tsconfig-paths": "^4.2.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ impl ShinkaiNodeOptions {
let mut model = "llama3.1:8b-instruct-q4_1".to_string();
let hardware_summary = hardware_get_summary();
match hardware_summary.requirements_status {
RequirementsStatus::Minimum => {
model = "phi3:3.8b".to_string();
}
RequirementsStatus::StillUsable | RequirementsStatus::Unmeet => {
model = "qwen2:1.5b-instruct-q4_K_M".to_string();
RequirementsStatus::Minimum | RequirementsStatus::StillUsable | RequirementsStatus::Unmeet => {
model = "gemma2:2b-instruct-q4_1".to_string();
}
_ => {}
}
Expand Down
25 changes: 16 additions & 9 deletions apps/shinkai-desktop/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,30 @@

use std::sync::Arc;

use crate::commands::galxe::galxe_generate_proof;
use crate::commands::hardware::hardware_get_summary;
use crate::commands::shinkai_node_manager_commands::{
shinkai_node_get_last_n_logs, shinkai_node_get_ollama_api_url, shinkai_node_get_options,
shinkai_node_is_running, shinkai_node_kill, shinkai_node_remove_storage,
shinkai_node_set_default_options, shinkai_node_set_options, shinkai_node_spawn, shinkai_node_get_default_model
shinkai_node_get_default_model, shinkai_node_get_last_n_logs, shinkai_node_get_ollama_api_url,
shinkai_node_get_options, shinkai_node_is_running, shinkai_node_kill,
shinkai_node_remove_storage, shinkai_node_set_default_options, shinkai_node_set_options,
shinkai_node_spawn,
};
use crate::commands::galxe::galxe_generate_proof;

use globals::SHINKAI_NODE_MANAGER_INSTANCE;
use local_shinkai_node::shinkai_node_manager::ShinkaiNodeManager;
use tauri::GlobalShortcutManager;
use tauri::SystemTrayMenuItem;
use tauri::{CustomMenuItem, Manager, RunEvent, SystemTray, SystemTrayEvent, SystemTrayMenu};
use tauri::{
CustomMenuItem, LogicalSize, Manager, RunEvent, SystemTray, SystemTrayEvent, SystemTrayMenu,
};
use tauri::{GlobalShortcutManager, Size};
use tauri::{PhysicalSize, SystemTrayMenuItem};
use tokio::sync::Mutex;

mod audio;
mod commands;
mod galxe;
mod globals;
mod local_shinkai_node;
mod hardware;
mod galxe;
mod local_shinkai_node;

fn main() {
let quit = CustomMenuItem::new("quit".to_string(), "Quit");
Expand Down Expand Up @@ -163,6 +166,10 @@ fn main() {
.unwrap();
let _ = new_window.set_title("Shinkai Node Manager");
let _ = new_window.set_resizable(true);
let _ = new_window.set_size(Size::Logical(LogicalSize {
width: 1280.0,
height: 820.0,
}));
}
"quit" => {
tauri::async_runtime::spawn(async {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { useTranslation } from '@shinkai_network/shinkai-i18n';
import { Badge } from '@shinkai_network/shinkai-ui';
import { cn } from '@shinkai_network/shinkai-ui/utils';
import { ALargeSmall, Images } from 'lucide-react';
import { ReactNode } from 'react';

import { OllamaModelCapability } from '../../../lib/shinkai-node-manager/ollama-models';

export const ModelCapabilityTag = ({
className,
capability,
...props
}: {
capability: OllamaModelCapability;
} & React.HTMLAttributes<HTMLDivElement>) => {
const { t } = useTranslation();

const capabilityMap: {
[key in OllamaModelCapability]: { text: string; icon: ReactNode };
} = {
[OllamaModelCapability.ImageToText]: {
icon: <Images className="h-4 w-4" />,
text: t('shinkaiNode.models.labels.visionCapability'),
},
[OllamaModelCapability.TextGeneration]: {
icon: <ALargeSmall className="h-4 w-4" />,
text: t('shinkaiNode.models.labels.textCapability'),
},
};
return (
<Badge
className={cn(
'justify-center rounded-full bg-blue-700 px-2 py-1 font-normal capitalize text-blue-200',
className,
)}
variant="outline"
{...props}
>
{capabilityMap[capability].icon}
<span className="ml-2">{capabilityMap[capability].text}</span>
</Badge>
);
};
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
import { t } from '@shinkai_network/shinkai-i18n';
import { Badge } from '@shinkai_network/shinkai-ui';
import { cn } from '@shinkai_network/shinkai-ui/utils';
import { Sparkles } from 'lucide-react';

import { OllamaModelQuality } from '../../../lib/shinkai-node-manager/ollama-models';

export const ModelQuailityTag = ({
className,
quality,
...props
}: {
quality: OllamaModelQuality;
}) => {
} & React.HTMLAttributes<HTMLDivElement>) => {
const colorMap: { [key in OllamaModelQuality]: string } = {
[OllamaModelQuality.Bad]: 'bg-red-900 text-red-400',
[OllamaModelQuality.Low]: 'bg-orange-900 text-orange-400',
[OllamaModelQuality.Medium]: 'text-yellow-400 bg-yellow-900',
[OllamaModelQuality.Good]: 'text-green-400 bg-green-900',
[OllamaModelQuality.Great]: 'text-green-400 bg-green-900',
[OllamaModelQuality.Low]: 'text-orange-200 bg-orange-900',
[OllamaModelQuality.Medium]: 'text-yellow-200 bg-yellow-900',
[OllamaModelQuality.Good]: 'text-green-200 bg-green-900',
};
return (
<Badge
className={cn(
'rounded-full border-0 px-2 py-1 font-normal capitalize',
'items-center justify-center rounded-full border-0 px-2 py-1 font-normal capitalize',
colorMap[quality],
className,
)}
variant="outline"
{...props}
>
{quality}
<Sparkles className="h-4 w-4" />
<span className="ml-2">
{quality} {t('shinkaiNode.models.labels.quality')}
</span>
</Badge>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@ import { OllamaModelSpeed } from '../../../lib/shinkai-node-manager/ollama-model

export const ModelSpeedTag = ({ speed }: { speed: OllamaModelSpeed }) => {
const emojiMap: { [key in OllamaModelSpeed]: string } = {
[OllamaModelSpeed.VerySlow]: '🐌',
[OllamaModelSpeed.Slow]: '🐢',
[OllamaModelSpeed.Average]: '🐕',
[OllamaModelSpeed.Fast]: '🐎',
[OllamaModelSpeed.VeryFast]: '🐆',
};
const colorMap: { [key in OllamaModelSpeed]: string } = {
[OllamaModelSpeed.Average]: 'text-orange-200 bg-orange-900',
[OllamaModelSpeed.Fast]: 'text-yellow-200 bg-yellow-900',
[OllamaModelSpeed.VeryFast]: 'text-green-200 bg-green-900',
};
return (
<div className={cn(' whitespace-nowrap px-2 font-normal capitalize')}>
{speed} {emojiMap[speed]}
<div
className={cn(
'flex flex-row items-center justify-center whitespace-nowrap rounded-full border-0 bg-gray-900 px-2 py-1 font-normal capitalize text-gray-400',
colorMap[speed],
)}
>
<span>{emojiMap[speed]}</span>
<span className="ml-2">{speed}</span>
</div>
);
};
Loading

0 comments on commit ac7e864

Please sign in to comment.