The AI Core Interface is the primary visual centerpiece of the BuildWithPNJ public cockpit dashboard. It provides real-time diagnostic status readouts, simulated agent node operations, and visual data packet traversals, backed by a localized SQL rule-based AI Wellness Coach that summarizes personal Life OS metrics.
Most AI applications display their artificial intelligence status using static text labels or simple generic spinning loading rings. This fails to convey the underlying complexity of multi-agent workflows, model contexts, database lookups, and embedding pings.
We needed to:
The AI centerpiece uses high-performance HTML5 Canvas renderings for fluid telemetry, while the backend routes wellness metrics through SQL aggregations to feed the local coach layout.
graph TD
Client[Next.js Client] -->|Canvas Render| HUD[HUD Telemetry HUD]
Client -->|Query Metrics| DB[(PostgreSQL Database)]
DB -->|SQL Aggregator| Backend[FastAPI aicoach Router]
Backend -->|Generate Advice| CoachWidget[AI Wellness Coach Widget]
AICoreVisualization: Houses the canvas orbits, glowing concentric rings, and dynamic text pings (RAG, LLM, PGVECTOR)./api/aicoach/insights Router: Processes SQL queries compiling current habits check-in lists, active event intervals, and sobriety indices.routers/aicoach.py)Rather than spinning up dynamic LangChain pipelines for basic summary metrics, we developed a fast, localized SQL evaluator compiling statistical counts and returning deterministic, human-like summaries based on active wellness states:
@router.get("/insights")
async def get_wellness_insights(db: AsyncSession = Depends(get_db)):
# Calculate habits check rate
habits = await db.execute(select(Habit))
# ... aggregate stats ...
# Select advice based on counts
if completion_rate > 0.85:
advice = "System operations nominal. Momentum index remains high."
else:
advice = "Low execution frequency detected in morning routines. Recommend scheduling friction-reduction barriers."
return {"insights": advice, "score": completion_rate}
pgvector lookups.