fox/database/seeders/FoxBrainSeeder.php

228 lines
10 KiB
PHP

<?php
namespace Database\Seeders;
use App\Models\Fox\FoxMemoryEdge;
use App\Models\Fox\FoxMemoryNode;
use Illuminate\Database\Seeder;
class FoxBrainSeeder extends Seeder
{
public function run(): void
{
FoxMemoryEdge::query()->delete();
FoxMemoryNode::query()->delete();
// ── Core ─────────────────────────────────────────────────────────────
$fox = FoxMemoryNode::create([
'type' => 'skill',
'title' => 'Fox',
'content' => 'Persönlicher KI-Assistent. Versteht Sprache, steuert HUD, speichert Wissen. Läuft auf Laravel 12 + Livewire + Alpine.js.',
'confidence' => 1.0,
'weight' => 10,
]);
$boban = FoxMemoryNode::create([
'type' => 'user',
'title' => 'Boban',
'content' => 'Eigentümer und Entwickler des Fox-Systems. Email: boban.blaskovic@gmail.com. Wohnt in Wien.',
'confidence' => 1.0,
'weight' => 9,
]);
$project = FoxMemoryNode::create([
'type' => 'project',
'title' => 'Fox Projekt',
'content' => 'Das Fox HUD System — persönlicher KI-Assistent mit HUD, Karte, Brain-Graph, Sprachsteuerung, Code-Panel und Smart-Home-Integration.',
'confidence' => 1.0,
'weight' => 9,
]);
// ── Standort ─────────────────────────────────────────────────────────
$wien = FoxMemoryNode::create([
'type' => 'place',
'title' => 'Wien',
'content' => 'Heimatstadt. Koordinaten: 48.2082° N, 16.3738° E. Fox zeigt die U-Bahn und Wiener Stadtplan.',
'confidence' => 1.0,
'weight' => 7,
]);
// ── Frameworks / Sprachen ─────────────────────────────────────────────
$laravel = FoxMemoryNode::create([
'type' => 'skill',
'title' => 'Laravel 12',
'content' => 'PHP-Framework. Backend für Fox: Routing, Livewire, Events, Broadcasting, Queues.',
'confidence' => 1.0,
'weight' => 8,
]);
$livewire = FoxMemoryNode::create([
'type' => 'skill',
'title' => 'Livewire 3',
'content' => 'Reactive PHP-Komponenten ohne extra JavaScript. Fox HUD ist eine Livewire-Komponente.',
'confidence' => 1.0,
'weight' => 7,
]);
$alpine = FoxMemoryNode::create([
'type' => 'skill',
'title' => 'Alpine.js',
'content' => 'Leichtgewichtiges JS-Framework. Fox HUD nutzt Alpine für alle UI-States (Karte, Brain, Panels).',
'confidence' => 1.0,
'weight' => 7,
]);
$threejs = FoxMemoryNode::create([
'type' => 'skill',
'title' => 'Three.js',
'content' => 'WebGL-3D-Bibliothek. Zeichnet den Fox Brain Graph: schwebende Knoten, Linien, Glow-Texturen.',
'confidence' => 1.0,
'weight' => 6,
]);
$php = FoxMemoryNode::create([
'type' => 'skill',
'title' => 'PHP 8.3',
'content' => 'Primäre Backend-Sprache. Fox Agent, Memory Service, Intent Detector — alles PHP.',
'confidence' => 1.0,
'weight' => 7,
]);
$javascript = FoxMemoryNode::create([
'type' => 'skill',
'title' => 'JavaScript',
'content' => 'Frontend-Sprache. Fox HUD JS-Komponente, Brain Graph, Karten-Integration, Sprachsteuerung.',
'confidence' => 1.0,
'weight' => 7,
]);
// ── Tools / Infrastruktur ─────────────────────────────────────────────
$docker = FoxMemoryNode::create([
'type' => 'skill',
'title' => 'Docker',
'content' => 'Container-Umgebung. Fox läuft in fox-app (PHP), fox-vite (JS-Build), fox-db (PostgreSQL) Containern.',
'confidence' => 1.0,
'weight' => 6,
]);
$vite = FoxMemoryNode::create([
'type' => 'skill',
'title' => 'Vite',
'content' => 'Build-Tool für Assets. Bündelt JS/CSS mit Content-Hashes. Build läuft im fox-vite Container.',
'confidence' => 1.0,
'weight' => 5,
]);
$postgres = FoxMemoryNode::create([
'type' => 'skill',
'title' => 'PostgreSQL',
'content' => 'Datenbank. Speichert Fox Memory Nodes, Edges, Learning Events, Snapshots.',
'confidence' => 1.0,
'weight' => 6,
]);
// ── KI-Dienste ────────────────────────────────────────────────────────
$ollama = FoxMemoryNode::create([
'type' => 'preference',
'title' => 'Ollama',
'content' => 'Lokales LLM. Bevorzugtes Modell: qwen2.5:32b. Läuft lokal — kein Cloud-Datenschutzproblem.',
'confidence' => 1.0,
'weight' => 7,
]);
$openai = FoxMemoryNode::create([
'type' => 'preference',
'title' => 'OpenAI API',
'content' => 'Cloud-LLM-Fallback. GPT-4 via OpenAI API. Wird genutzt wenn Ollama nicht antwortet.',
'confidence' => 0.9,
'weight' => 6,
]);
$reverb = FoxMemoryNode::create([
'type' => 'skill',
'title' => 'Laravel Reverb',
'content' => 'WebSocket-Server. Ermöglicht Real-Time-Events: Fox-Aktionen (Karte, Brain, Code) werden live gepusht.',
'confidence' => 1.0,
'weight' => 6,
]);
// ── HUD-Komponenten ───────────────────────────────────────────────────
$hud = FoxMemoryNode::create([
'type' => 'project',
'title' => 'Fox HUD',
'content' => 'Heads-Up-Display. Vollbild-Overlay mit Zeit, Wetter, Status, Mikrofon, Karte, Brain, Code-Panel.',
'confidence' => 1.0,
'weight' => 8,
]);
$karte = FoxMemoryNode::create([
'type' => 'project',
'title' => 'Karte',
'content' => 'Mapbox GL JS Karte im HUD. Zeigt Wien, U-Bahn-Linien, POIs, Routen. Blendet sich wie der Brain-Graph ein.',
'confidence' => 1.0,
'weight' => 6,
]);
$brain = FoxMemoryNode::create([
'type' => 'project',
'title' => 'Brain Graph',
'content' => 'Three.js Visualisierung des Fox-Gedächtnisses. Fox im Zentrum, Knoten schweben im 3D-Raum.',
'confidence' => 1.0,
'weight' => 7,
]);
$sprache = FoxMemoryNode::create([
'type' => 'skill',
'title' => 'Sprachsteuerung',
'content' => 'Whisper-API transkribiert Mikrofon-Input. IntentDetector erkennt Absichten direkt. LLM als Fallback.',
'confidence' => 1.0,
'weight' => 7,
]);
// ── Edges ─────────────────────────────────────────────────────────────
$edges = [
[$boban, $fox, 'owns', 1.0],
[$boban, $project, 'owns', 1.0],
[$boban, $wien, 'lives_in', 1.0],
[$fox, $project, 'belongs_to', 1.0],
[$fox, $ollama, 'uses', 1.0],
[$fox, $openai, 'uses', 0.8],
[$fox, $reverb, 'uses', 1.0],
[$fox, $sprache, 'has_feature', 1.0],
[$fox, $hud, 'has_feature', 1.0],
[$fox, $brain, 'has_feature', 1.0],
[$fox, $karte, 'has_feature', 1.0],
[$project, $laravel, 'uses', 1.0],
[$project, $livewire, 'uses', 1.0],
[$project, $alpine, 'uses', 1.0],
[$project, $threejs, 'uses', 1.0],
[$project, $docker, 'uses', 1.0],
[$project, $vite, 'uses', 1.0],
[$project, $postgres, 'uses', 1.0],
[$laravel, $php, 'built_on', 1.0],
[$laravel, $livewire, 'includes', 1.0],
[$laravel, $reverb, 'includes', 1.0],
[$hud, $alpine, 'uses', 1.0],
[$brain, $threejs, 'uses', 1.0],
[$karte, $project, 'part_of', 1.0],
[$docker, $vite, 'runs', 0.9],
[$docker, $postgres, 'runs', 1.0],
[$sprache, $ollama, 'calls', 1.0],
[$sprache, $openai, 'calls', 0.8],
];
foreach ($edges as [$src, $tgt, $rel, $str]) {
FoxMemoryEdge::create([
'source_node_id' => $src->id,
'target_node_id' => $tgt->id,
'relation' => $rel,
'strength' => $str,
]);
}
$nodeCount = FoxMemoryNode::count();
$edgeCount = FoxMemoryEdge::count();
$this->command->info("Fox Brain seeded: {$nodeCount} nodes, {$edgeCount} edges.");
}
}