flowchart LR U[User / Admin] --> UI[Angular frontend] UI -->|REST + session cookie + CSRF| API[FastAPI API] UI <-->|WebSocket: PCM + JSON events| API API --> AUTH[Authentication / role / organization] API -->|Upload: independent document + job| DB[(PostgreSQL + pgvector)] API --> FS[(Immutable originals / extraction artifacts)] W[Separate ingestion worker] -->|Claim job + lease + heartbeat| DB W -->|Read original / retain extraction| FS W --> OCR[OpenRouter vision / Gemini Flash] W --> EMB[Local Ollama / bge-m3] W -->|Atomic chunks + vectors publication| DB API --> RT[OpenAI Realtime adapter] RT <-->|Provider WebSocket| OAI[OpenAI gpt-realtime-2.1 / Marin] RT -->|Validated tools| SEARCH[Shared backend SearchService] SEARCH --> EMB SEARCH -->|Eligible document chunks| DB API -->|Selection / revision invalidation| DB