diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..4d915bd --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,18 @@ +{ + "permissions": { + "allow": [ + "Bash(rm:*)", + "Bash(mkdir:*)", + "Bash(mv:*)", + "Bash(python install_video_tools.py:*)", + "Bash(python generate_narration.py:*)", + "Bash(python:*)", + "Bash(dir:*)", + "Bash(nul)", + "Bash(findstr:*)", + "Bash(ffmpeg:*)" + ], + "deny": [], + "ask": [] + } +} diff --git a/_download_models.py b/_download_models.py new file mode 100644 index 0000000..e69de29 diff --git a/_download_models_temp.py b/_download_models_temp.py new file mode 100644 index 0000000..a99bf74 --- /dev/null +++ b/_download_models_temp.py @@ -0,0 +1,55 @@ + +import os +from huggingface_hub import snapshot_download +from tqdm import tqdm + +print("\nDownloading AI video generation models...") +print("This will download approximately 11GB of models") +print("-" * 50) + +# Create models directory +os.makedirs("models", exist_ok=True) + +models_to_download = [ + { + "name": "ZeroScope V2 (Fast, 1.7GB)", + "repo": "cerspense/zeroscope_v2_576w", + "path": "models/zeroscope" + }, + { + "name": "ModelScope Text2Video (3.5GB)", + "repo": "damo-vilab/text-to-video-ms-1.7b", + "path": "models/modelscope" + }, + { + "name": "AnimateDiff Motion Module (1.7GB)", + "repo": "guoyww/animatediff-motion-adapter-v1-5-2", + "path": "models/animatediff-motion" + }, + { + "name": "Stable Diffusion 1.5 Base (4.3GB)", + "repo": "runwayml/stable-diffusion-v1-5", + "path": "models/sd15" + } +] + +for i, model in enumerate(models_to_download, 1): + print(f"\n[{i}/4] Downloading {model['name']}...") + print(f" Repository: {model['repo']}") + print(f" Saving to: {model['path']}") + + try: + snapshot_download( + repo_id=model['repo'], + local_dir=model['path'], + resume_download=True, + ignore_patterns=["*.bin"] if "stable-diffusion" in model['repo'] else None + ) + print(f" [OK] Downloaded successfully!") + except Exception as e: + print(f" [ERROR] Failed: {e}") + print(f" Manual download: https://huggingface.co/{model['repo']}") + +print("\n" + "=" * 50) +print("MODEL DOWNLOAD COMPLETE!") +print("=" * 50) diff --git a/collab/3d-worlds/README.md b/collab/3d-worlds/README.md deleted file mode 100644 index 989180d..0000000 --- a/collab/3d-worlds/README.md +++ /dev/null @@ -1,605 +0,0 @@ -# 3D Worlds for Qdrant -**UUID:** e5f6g7h8-i9j0-1234-efgh-456789012345 -**Multi-Dimensional Visualization Suite** | ISA-95 L3-L4 - -Interactive 3D visualizations of Qdrant vector database operations, following the PackML structure of executable markdown files with autonomous agents. - -## 🌟 Overview - -This directory contains self-contained 3D world visualizations for understanding and monitoring Qdrant vector database operations. Each markdown file is an executable HTML application that runs entirely in the browser. - -## 📁 Structure - -``` -collab/3d-worlds/ -├── README.md # This file -├── vector-space-3d.md # Vector embeddings in 3D space -├── collection-topology.md # Collection network visualization -├── query-flow-visualizer.md # Query pipeline animation -└── cluster-network-3d.md # Distributed cluster topology -``` - -## 🎯 3D Worlds - -### 1. Vector Space 3D -**File:** `vector-space-3d.md` -**UUID:** a1b2c3d4-e5f6-7890-abcd-ef1234567890 - -Visualize high-dimensional vector embeddings projected into 3D space with autonomous agents managing clusters and similarity search. - -**Features:** -- 3D point cloud of vectors -- Real-time similarity search -- K-means clustering visualization -- Self-organizing vector layout -- Collection switching (isa|code|img|audio|doc) - -**Agents:** -- **Clusterer**: Automatic K-means clustering -- **Searcher**: Random similarity queries -- **Organizer**: Pulls similar vectors together -- **Spawner**: Creates new vectors - -**Use Cases:** -- Understand vector distributions -- Visualize clustering quality -- Debug similarity calculations -- Explore collection characteristics - ---- - -### 2. Collection Topology 3D -**File:** `collection-topology.md` -**UUID:** b2c3d4e5-f6g7-8901-bcde-f12345678901 - -Network visualization showing relationships between Qdrant collections with data flow and cross-collection queries. - -**Features:** -- Collection nodes sized by vector count -- Animated query routing -- Network optimization -- Real-time statistics -- Connection strength visualization - -**Agents:** -- **Router**: Routes cross-collection queries -- **Balancer**: Load balances query distribution -- **Optimizer**: Repositions nodes for efficiency -- **Monitor**: Tracks network performance - -**Use Cases:** -- Understand collection relationships -- Visualize query patterns -- Optimize multi-collection searches -- Monitor network health - ---- - -### 3. Query Flow Visualizer 3D -**File:** `query-flow-visualizer.md` -**UUID:** c3d4e5f6-g7h8-9012-cdef-234567890123 - -Animated pipeline showing query execution from input through embedding, search, scoring, ranking to results. - -**Features:** -- 6-stage pipeline visualization -- Animated query particles -- Score distribution display -- Performance metrics per stage -- Latency breakdown - -**Pipeline Stages:** -1. **Input**: Query reception -2. **Embed**: Text → Vector (1536d) -3. **Search**: HNSW similarity search -4. **Score**: Cosine similarity calculation -5. **Rank**: Top-K selection -6. **Output**: Result formatting - -**Use Cases:** -- Debug query performance -- Identify pipeline bottlenecks -- Understand query flow -- Measure stage latency - ---- - -### 4. Cluster Network 3D -**File:** `cluster-network-3d.md` -**UUID:** d4e5f6g7-h8i9-0123-defg-345678901234 - -Distributed Qdrant cluster with nodes, shards, replication, and Raft consensus visualization. - -**Features:** -- Multi-node cluster topology -- Shard distribution -- Replica placement -- Raft leader election -- Automatic failover -- Load metrics (CPU, memory, disk) - -**Operations:** -- Add nodes dynamically -- Simulate node failures -- Automatic shard rebalancing -- Heartbeat visualization - -**Use Cases:** -- Plan cluster topology -- Test failover scenarios -- Monitor cluster health -- Understand distributed consensus - ---- - -## 🚀 Quick Start - -### Option 1: Direct Browser (Recommended) - -1. **Open in Browser:** - ```bash - # Start simple HTTP server - python -m http.server 8080 - - # Navigate to: - http://localhost:8080/collab/3d-worlds/vector-space-3d.md - ``` - -2. **Or open file directly:** - - Right-click on any .md file - - Open with browser (Chrome, Firefox, Edge) - -### Option 2: Live Server (VS Code) - -1. Install "Live Server" extension -2. Right-click on .md file -3. Select "Open with Live Server" - -### Option 3: GitHub Pages - -Access deployed versions: -``` -https://teslasolar.github.io/qdrant/collab/3d-worlds/vector-space-3d.md -https://teslasolar.github.io/qdrant/collab/3d-worlds/collection-topology.md -https://teslasolar.github.io/qdrant/collab/3d-worlds/query-flow-visualizer.md -https://teslasolar.github.io/qdrant/collab/3d-worlds/cluster-network-3d.md -``` - -## 🎮 Universal Controls - -### Mouse/Trackpad -- **Rotate**: Automatic camera orbit -- **Zoom**: Scroll wheel (not implemented in current version) - -### Keyboard -- **Enter**: Submit terminal command -- **Type**: Enter commands in terminal input - -### Buttons -Each world has custom buttons for common operations: -- **INITIALIZE**: Start the 3D world -- **Action buttons**: World-specific operations - -### Terminal Commands -Type commands in the terminal input: -- `help` - Show available commands -- `stats` - Display statistics -- World-specific commands (see individual README sections) - -## 🤖 Autonomous Agent System - -All 3D worlds feature autonomous agents following ISA-88 PackML principles: - -### Agent Lifecycle -``` -IDLE → STARTING → EXECUTE → COMPLETING → COMPLETE -``` - -### Agent Communication -Agents operate independently in async loops: -```javascript -createAgent(name, type, behavior) { - const agent = { - name, type, active: true, cycles: 0, mem: {}, - run: async () => { - while (agent.active) { - await behavior.call(agent); - agent.cycles++; - await sleep(100 + Math.random() * 200); - } - } - }; - agents.set(name, agent); - return agent; -} -``` - -### Agent Behaviors -Each agent has a custom behavior function: -- Access to `this.mem` for persistent memory -- `this.cycles` for iteration count -- Async execution with random delays -- Self-managing and self-healing - -## 🏗️ Architecture - -### PackML Structure - -Following the ISA-88 PackML (Packaging Machine Language) pattern: - -``` -┌─────────────────────────────────────────┐ -│ Markdown Container │ ← Single .md file -├─────────────────────────────────────────┤ -│ HTML/JavaScript │ ← Executable code -│ ┌───────────────────────────────┐ │ -│ │ Three.js Scene │ │ ← 3D rendering -│ │ ┌─────────────────────┐ │ │ -│ │ │ Autonomous Agents │ │ │ ← AI behaviors -│ │ └─────────────────────┘ │ │ -│ └───────────────────────────────┘ │ -└─────────────────────────────────────────┘ -``` - -### ISA-95 Hierarchy Mapping - -- **L4 (Business)**: Multi-world orchestration, analytics -- **L3 (MES)**: Agent coordination, data management -- **L2 (Supervisory)**: 3D visualization, monitoring -- **L1 (Control)**: User input, command execution -- **L0 (Field)**: Raw data (vectors, nodes, queries) - -### Technology Stack - -| Component | Technology | Purpose | -|-----------|-----------|---------| -| **3D Engine** | THREE.js r128 | WebGL rendering | -| **Packaging** | Markdown + HTML | Self-contained executables | -| **Agents** | Async JavaScript | Autonomous behaviors | -| **UI** | Vanilla JS + Canvas | Terminal and controls | -| **Data** | In-memory JS | Vector storage | - -## 🔬 Technical Details - -### THREE.js Setup - -All worlds use consistent THREE.js initialization: - -```javascript -scene = new THREE.Scene(); -camera = new THREE.PerspectiveCamera(75, width/height, 0.1, 2000); -renderer = new THREE.WebGLRenderer({canvas, antialias: true}); - -// Standard lighting -scene.add(new THREE.AmbientLight(0x404040)); -const light = new THREE.DirectionalLight(0xffffff, 1); -scene.add(light); - -// Grid helper -const grid = new THREE.GridHelper(400, 80, 0x00ff00, 0x003300); -scene.add(grid); -``` - -### Camera Animation - -Automatic orbital camera: -```javascript -animate() { - const t = Date.now() * 0.001; - camera.position.x = Math.cos(t * 0.05) * 200; - camera.position.z = Math.sin(t * 0.05) * 200; - camera.lookAt(0, 50, 0); -} -``` - -### Color Schemes - -Consistent color palette across all worlds: -- **Cyan** (#00ffff): Primary UI, collections -- **Magenta** (#ff00ff): Leaders, important nodes -- **Yellow** (#ffff00): Warnings, processing -- **Green** (#00ff00): Success, active connections -- **Red** (#ff0000): Errors, failures -- **Orange** (#ff6600): Secondary elements - -### Performance Optimization - -- **Geometry reuse**: Create once, instance many -- **Material sharing**: Minimize draw calls -- **Object pooling**: Reuse particles and effects -- **Lazy cleanup**: setTimeout for disposal -- **Request animation frame**: Smooth 60 FPS - -## 📊 Data Integration - -### Mock Data (Default) - -All worlds generate realistic mock data: -- Random vector embeddings -- Simulated query latencies -- Fake cluster topology - -### Real Qdrant Integration - -Connect to live Qdrant instance: - -```javascript -// Fetch real collections -const collections = await fetch('http://localhost:6333/collections') - .then(r => r.json()); - -// Real vector search -const results = await fetch('http://localhost:6333/collections/isa/points/search', { - method: 'POST', - body: JSON.stringify({ - vector: embedding, - limit: 10 - }) -}).then(r => r.json()); - -// Update visualization -updateVectors(results.result); -``` - -### WebSocket Streaming - -For real-time updates: - -```javascript -const ws = new WebSocket('ws://localhost:6333/stream'); -ws.onmessage = (event) => { - const data = JSON.parse(event.data); - if (data.type === 'vector_added') { - addVector(data.vector); - } -}; -``` - -## 🎯 Use Cases - -### 1. Education -- **Students**: Learn vector databases visually -- **Workshops**: Interactive demonstrations -- **Training**: Hands-on Qdrant exploration - -### 2. Development -- **Debugging**: Visualize query behavior -- **Testing**: Cluster failover scenarios -- **Optimization**: Identify bottlenecks - -### 3. Operations -- **Monitoring**: Real-time cluster health -- **Capacity Planning**: Visualize growth -- **Troubleshooting**: Understand issues - -### 4. Presentations -- **Demos**: Impressive 3D visualizations -- **Sales**: Show Qdrant capabilities -- **Conferences**: Interactive exhibits - -## 🛠️ Customization - -### Adding New Worlds - -Create new .md file: - -```markdown -# My Custom 3D World -**UUID:** [generate-uuid] -**Type:** Custom Visualization - -## Executable HTML - -\`\`\`html - - -
- - - - - - - -\`\`\` -``` - -### Customizing Agents - -Modify agent behaviors: - -```javascript -customBehavior: async function() { - if (this.cycles % 10 === 0) { - // Do something every 10 cycles - this.mem.actionCount = (this.mem.actionCount || 0) + 1; - } -} -``` - -### Styling - -Update CSS in ` - -