mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 19:01:08 +02:00
feat(chat): add all Mac Mini Ollama models to playground
- Add qwen2.5-coder:7b (State-of-the-Art coding, 92.7% HumanEval) - Add llava:7b (Vision/image analysis) - Add qwen3-vl:4b (Fast vision-language) - Add deepseek-ocr (Document OCR) - Add phi3.5 (Compact & efficient) - Add ministral-3:3b (Very fast) - Create add-local-models.ts script for upsert - Update documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
004fe85799
commit
5d5e42c770
4 changed files with 238 additions and 4 deletions
|
|
@ -135,11 +135,17 @@ PUBLIC_BACKEND_URL=http://localhost:3002
|
|||
|
||||
## AI Models Available
|
||||
|
||||
### Local Models (Ollama - Free)
|
||||
### Local Models (Ollama - Free, runs on Mac Mini)
|
||||
|
||||
| Model ID | Name | Provider | Best For |
|
||||
| -------- | ---- | -------- | -------- |
|
||||
| ...440101 | Gemma 3 4B (Lokal) | ollama | Everyday tasks (default) - runs on Mac Mini |
|
||||
| Model ID | Name | Best For |
|
||||
| -------- | ---- | -------- |
|
||||
| ...440101 | Gemma 3 4B (Lokal) | Everyday tasks (default) |
|
||||
| ...440102 | Qwen2.5 Coder 7B (Lokal) | Code generation (92.7% HumanEval) |
|
||||
| ...440103 | LLaVA 7B Vision (Lokal) | Image/screenshot analysis |
|
||||
| ...440104 | Qwen3 VL 4B (Lokal) | Fast image analysis |
|
||||
| ...440105 | DeepSeek OCR (Lokal) | Text recognition in images |
|
||||
| ...440106 | Phi 3.5 (Lokal) | Compact, efficient |
|
||||
| ...440107 | Ministral 3B (Lokal) | Very fast, simple tasks |
|
||||
|
||||
### Cloud Models (OpenRouter - Paid)
|
||||
|
||||
|
|
@ -152,6 +158,13 @@ PUBLIC_BACKEND_URL=http://localhost:3002
|
|||
| ...440205 | Claude 3.5 Sonnet | $3/M | Best quality |
|
||||
| ...440206 | GPT-4o Mini | $0.15/M | Balanced performance |
|
||||
|
||||
### Adding New Local Models
|
||||
|
||||
```bash
|
||||
# Add new models to existing database
|
||||
pnpm --filter @chat/backend db:add-local-models
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. **Get OpenRouter API key** at https://openrouter.ai/keys
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
"db:push": "drizzle-kit push",
|
||||
"db:studio": "drizzle-kit studio",
|
||||
"db:seed": "tsx src/db/seed.ts",
|
||||
"db:add-local-models": "tsx src/db/add-local-models.ts",
|
||||
"db:add-ollama": "psql $DATABASE_URL -f src/db/migrations/add-ollama-model.sql",
|
||||
"docker:build": "docker compose build",
|
||||
"docker:up": "docker compose up -d",
|
||||
|
|
|
|||
142
apps/chat/apps/backend/src/db/add-local-models.ts
Normal file
142
apps/chat/apps/backend/src/db/add-local-models.ts
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
/**
|
||||
* Add Local Models Script
|
||||
* Adds new local Ollama models to existing database (upsert)
|
||||
*/
|
||||
import { drizzle } from 'drizzle-orm/postgres-js';
|
||||
import { eq } from 'drizzle-orm';
|
||||
import postgres from 'postgres';
|
||||
import { models } from './schema';
|
||||
import * as dotenv from 'dotenv';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const connectionString =
|
||||
process.env.DATABASE_URL || 'postgresql://chat:password@localhost:5432/chat';
|
||||
|
||||
async function addLocalModels() {
|
||||
console.log('Adding local Ollama models...');
|
||||
|
||||
const client = postgres(connectionString);
|
||||
const db = drizzle(client);
|
||||
|
||||
// New local models to add
|
||||
const newModels = [
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440102',
|
||||
name: 'Qwen2.5 Coder 7B (Lokal)',
|
||||
description: 'State-of-the-Art Code-Modell - 92.7% HumanEval, kostenlos',
|
||||
provider: 'ollama',
|
||||
parameters: {
|
||||
model: 'qwen2.5-coder:7b',
|
||||
temperature: 0.3,
|
||||
max_tokens: 8192,
|
||||
},
|
||||
isActive: true,
|
||||
isDefault: false,
|
||||
},
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440103',
|
||||
name: 'LLaVA 7B Vision (Lokal)',
|
||||
description: 'Vision-Modell für Bildanalyse - kann Screenshots/Bilder verstehen',
|
||||
provider: 'ollama',
|
||||
parameters: {
|
||||
model: 'llava:7b',
|
||||
temperature: 0.7,
|
||||
max_tokens: 4096,
|
||||
},
|
||||
isActive: true,
|
||||
isDefault: false,
|
||||
},
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440104',
|
||||
name: 'Qwen3 VL 4B (Lokal)',
|
||||
description: 'Kompaktes Vision-Language Modell - schnelle Bildanalyse',
|
||||
provider: 'ollama',
|
||||
parameters: {
|
||||
model: 'qwen3-vl:4b',
|
||||
temperature: 0.7,
|
||||
max_tokens: 4096,
|
||||
},
|
||||
isActive: true,
|
||||
isDefault: false,
|
||||
},
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440105',
|
||||
name: 'DeepSeek OCR (Lokal)',
|
||||
description: 'Spezialisiert auf Texterkennung in Bildern und Dokumenten',
|
||||
provider: 'ollama',
|
||||
parameters: {
|
||||
model: 'deepseek-ocr:latest',
|
||||
temperature: 0.3,
|
||||
max_tokens: 4096,
|
||||
},
|
||||
isActive: true,
|
||||
isDefault: false,
|
||||
},
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440106',
|
||||
name: 'Phi 3.5 (Lokal)',
|
||||
description: 'Microsoft Phi 3.5 - kompakt und effizient',
|
||||
provider: 'ollama',
|
||||
parameters: {
|
||||
model: 'phi3.5:latest',
|
||||
temperature: 0.7,
|
||||
max_tokens: 4096,
|
||||
},
|
||||
isActive: true,
|
||||
isDefault: false,
|
||||
},
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440107',
|
||||
name: 'Ministral 3B (Lokal)',
|
||||
description: 'Mistral Mini - sehr schnell, gut für einfache Aufgaben',
|
||||
provider: 'ollama',
|
||||
parameters: {
|
||||
model: 'ministral-3:3b',
|
||||
temperature: 0.7,
|
||||
max_tokens: 4096,
|
||||
},
|
||||
isActive: true,
|
||||
isDefault: false,
|
||||
},
|
||||
];
|
||||
|
||||
try {
|
||||
let added = 0;
|
||||
let updated = 0;
|
||||
|
||||
for (const model of newModels) {
|
||||
// Check if model exists
|
||||
const existing = await db.select().from(models).where(eq(models.id, model.id));
|
||||
|
||||
if (existing.length > 0) {
|
||||
// Update existing
|
||||
await db.update(models).set(model).where(eq(models.id, model.id));
|
||||
console.log(` Updated: ${model.name}`);
|
||||
updated++;
|
||||
} else {
|
||||
// Insert new
|
||||
await db.insert(models).values(model);
|
||||
console.log(` Added: ${model.name}`);
|
||||
added++;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`\nDone! Added: ${added}, Updated: ${updated}`);
|
||||
|
||||
// Show all models
|
||||
const allModels = await db.select().from(models);
|
||||
console.log(`\nTotal models in database: ${allModels.length}`);
|
||||
console.log('\nLocal models:');
|
||||
allModels.filter((m) => m.provider === 'ollama').forEach((m) => console.log(` - ${m.name}`));
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
throw error;
|
||||
} finally {
|
||||
await client.end();
|
||||
}
|
||||
}
|
||||
|
||||
addLocalModels()
|
||||
.then(() => process.exit(0))
|
||||
.catch(() => process.exit(1));
|
||||
|
|
@ -48,6 +48,84 @@ async function seed() {
|
|||
isActive: true,
|
||||
isDefault: true, // Default model - free and local
|
||||
},
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440102',
|
||||
name: 'Qwen2.5 Coder 7B (Lokal)',
|
||||
description: 'State-of-the-Art Code-Modell - 92.7% HumanEval, kostenlos',
|
||||
provider: 'ollama',
|
||||
parameters: {
|
||||
model: 'qwen2.5-coder:7b',
|
||||
temperature: 0.3,
|
||||
max_tokens: 8192,
|
||||
},
|
||||
isActive: true,
|
||||
isDefault: false,
|
||||
},
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440103',
|
||||
name: 'LLaVA 7B Vision (Lokal)',
|
||||
description: 'Vision-Modell für Bildanalyse - kann Screenshots/Bilder verstehen',
|
||||
provider: 'ollama',
|
||||
parameters: {
|
||||
model: 'llava:7b',
|
||||
temperature: 0.7,
|
||||
max_tokens: 4096,
|
||||
},
|
||||
isActive: true,
|
||||
isDefault: false,
|
||||
},
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440104',
|
||||
name: 'Qwen3 VL 4B (Lokal)',
|
||||
description: 'Kompaktes Vision-Language Modell - schnelle Bildanalyse',
|
||||
provider: 'ollama',
|
||||
parameters: {
|
||||
model: 'qwen3-vl:4b',
|
||||
temperature: 0.7,
|
||||
max_tokens: 4096,
|
||||
},
|
||||
isActive: true,
|
||||
isDefault: false,
|
||||
},
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440105',
|
||||
name: 'DeepSeek OCR (Lokal)',
|
||||
description: 'Spezialisiert auf Texterkennung in Bildern und Dokumenten',
|
||||
provider: 'ollama',
|
||||
parameters: {
|
||||
model: 'deepseek-ocr:latest',
|
||||
temperature: 0.3,
|
||||
max_tokens: 4096,
|
||||
},
|
||||
isActive: true,
|
||||
isDefault: false,
|
||||
},
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440106',
|
||||
name: 'Phi 3.5 (Lokal)',
|
||||
description: 'Microsoft Phi 3.5 - kompakt und effizient',
|
||||
provider: 'ollama',
|
||||
parameters: {
|
||||
model: 'phi3.5:latest',
|
||||
temperature: 0.7,
|
||||
max_tokens: 4096,
|
||||
},
|
||||
isActive: true,
|
||||
isDefault: false,
|
||||
},
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440107',
|
||||
name: 'Ministral 3B (Lokal)',
|
||||
description: 'Mistral Mini - sehr schnell, gut für einfache Aufgaben',
|
||||
provider: 'ollama',
|
||||
parameters: {
|
||||
model: 'ministral-3:3b',
|
||||
temperature: 0.7,
|
||||
max_tokens: 4096,
|
||||
},
|
||||
isActive: true,
|
||||
isDefault: false,
|
||||
},
|
||||
// ============================================
|
||||
// OpenRouter Models (Cloud, paid)
|
||||
// ============================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue