# Tiered Pipeline UI Notes — For Daedalus 🎨 **From:** Socrates 🧠 **To:** Daedalus 🎨 **Date:** 2026-04-21 **Status:** ✅ **BACKEND WIRED AND READY** --- ## Quick Status Check Before building the UI, verify the Gaming PC is up: ```bash curl http://localhost:8000/admin/content/health ``` Expected response: ```json { "gaming_pc": {"available": true, "reason": "Ollama responding"}, "models": { "strategy": "llama3.1:8b", "structure": "qwen2.5-coder:7b", "draft": "phi4:14b", "seo": "llama3.1:8b" }, "pipeline_ready": true } ``` --- ## The Pipeline (Live on Gaming PC) | Stage | Model | Role | Latency | |-------|-------|------|---------| | 1. Strategy | Llama 3.1 8B | Brief + angle | ~10s | | 2. Structure | Qwen 2.5 7B | Validate angle before burning GPU time | ~15s | | 3. Draft | Phi-4 14B | Full 800-1200 word draft | **~60-90s** | | 4. SEO | Llama 3.1 8B | Excerpt, tags, meta | ~10s | | 5. Compliance | Python | Strip banned words, flag dates/names | ~1s | **Total: ~90-120 seconds** (varies with Phi-4 generation speed) The bottleneck is Stage 3 (Phi-4). Everything else is fast. --- ## Magic Wand Button — Loading State Since Stage 3 takes 60-90s, the UI needs clear progress indication: **Required UX:** - Clear spinner/progress bar - Current stage name (e.g., "Drafting with Phi-4...") - Estimated time remaining (seconds) - Disable button while running - Allow cancellation - Show warnings if compliance flags issues **Suggested pattern:** ``` [🪄 Generate Content] → click ↓ [⠋ Generating... Stage 3/5: Drafting with Phi-4 (~45s remaining)] [━━━━━━━━━━━░░░░░] 60% [Cancel] ``` --- ## API Endpoints (Ready) ### 1. Health Check ```bash GET /admin/content/health ``` Check if Gaming PC Ollama is available before allowing generation. ### 2. Start Generation ```bash POST /admin/content/generate Content-Type: application/json { "topic": "How I migrated from Google Calendar to CalDAV", "content_type": "how_i_solved", "outline": ["optional", "bullet", "points"], "context": "Additional notes" } ``` **Response:** ```json { "job_id": "gen_20260421_171500_a1b2c3", "status": "queued", "estimated_seconds": 90 } ``` ### 3. Poll for Status ```bash GET /admin/content/jobs/{job_id} ``` **Poll every 2-3 seconds.** Returns: ```json { "job_id": "gen_20260421_171500_a1b2c3", "status": "draft", "stage_number": 3, "total_stages": 5, "progress_percent": 60, "current_stage_name": "Drafting with Phi-4...", "estimated_seconds_remaining": 45, "started_at": "2026-04-21T17:15:00", "completed_at": null, "error": null, "result": null } ``` When complete, `result` contains the full output: ```json { "job_id": "gen_20260421_171500_a1b2c3", "status": "completed", "progress_percent": 100, "result": { "title": "The Night I Broke DNS", "content": "# The Night I Broke DNS\n\nIt was 7 PM...", "excerpt": "A DNS migration gone wrong and how I fixed it", "tags": ["dns", "tailscale", "homelab"], "meta_description": "How I migrated DNS and broke everything", "word_count": 1150, "reading_time_minutes": 6, "compliance": { "replacements_made": 2, "warnings": ["Found: 'leverage' → replaced with 'use'"], "is_compliant": true, "banned_words_found": ["leverage"], "dates_flagged": [], "names_flagged": [] } } } ``` ### 4. Cancel Job ```bash POST /admin/content/jobs/{job_id}/cancel ``` --- ## Content Types - `roundup` — Collection/review post - `how_i_solved` — Problem + solution narrative - `build_log` — Step-by-step project documentation - `essay` — Opinion/analysis piece - `tutorial` — Instructional content Default is `how_i_solved`. --- ## Error States | Error | HTTP Status | UI Display | |-------|-------------|-----------| | Gaming PC offline | 503 | "Gaming PC offline. Check Tailscale or retry later." | | Model timeout | 504 | "Generation timed out. Retry with shorter outline." | | Compliance flags | 200 | Show warnings but allow use (yellow banner) | | Job not found | 404 | "Job expired. Start over." | --- ## Files for Reference - Backend: `hoffdesk-api/content/pipeline.py` (the orchestrator) - Admin templates: `shared/project-docs/blog/templates/admin/` - Admin CSS: `shared/project-docs/blog/admin.css` --- ## Testing Want to see it work? SSH to the Beelink and run: ```bash cd /home/hoffmann_admin/.openclaw/workspace-socrates/hoffdesk-api python test_pipeline_live.py "Your topic here" ``` This actually hits the Gaming PC and takes ~90 seconds. --- **Backend is ready. Over to you for the Magic Wand UI.** — Socrates 🧠