graph TB
U[Parent User]
API[FastAPI Server localhost:8000]
R[Gemini 2.5 Flash Router & Classifier $0.30/1M tokens]
G[Claude 3.5 Haiku Response Generator $0.25/$1.25/1M tokens]
SD[Social Detector 50+ patterns]
HM[History Manager 10 messages]
SS[Social State]
SR[Social Responder]
KB[(Documents 9 MD files)]
U -->|POST /chat| API
API -->|Process| R
R --> SD
R --> HM
R --> SS
R --> KB
R -->|Generate| G
G --> HM
G --> SR
API -->|JSON Response| U
style U fill:#e1f5fe
style API fill:#fff3e0
style R fill:#f3e5f5
style G fill:#f3e5f5
style KB fill:#e8f5e9
sequenceDiagram
participant U as Parent
participant API as FastAPI
participant R as Gemini Router
participant G as Claude Generator
participant DB as Knowledge Base
U->>+API: POST /chat
API->>+R: Process message
Note over R: Check social intent Get history context
R->>DB: Search relevant docs
DB-->>R: Return documents
R-->>API: RouterResponse
API->>+G: Generate response
Note over G: Generate with social context 100-150 words
G-->>-API: Final response
API-->>-U: JSON response
Note over U: Time 5-7 sec Cost ~$0.0015