Web Data Flow (Admin)
This flow shows how web search results are collected and stored in the knowledge base.
Key Steps
- Run a web search from Admin → Web Data.
- Server calls OpenAI web search and returns markdown + citations.
- Results are shown in the UI for review.
- Add to Knowledge Base bundles results into a markdown file.
- Markdown is uploaded and indexed into the tenant vector store.
Mermaid Flow
flowchart TD
A["Admin Panel: Web Data Search"] --> B["Enter query + click Search"]
B --> C["POST /api/admin/tenant/{tenantId}/web-search"]
C --> D["OpenAI web search (gpt-4o-search-preview)"]
D --> E["Return markdown + citations"]
E --> F["UI displays results"]
F --> G["Click Add to Knowledge Base"]
G --> H["Combine results into markdown file"]
H --> I["POST /api/admin/tenant/{tenantId}/files/upload"]
I --> J["Upload markdown file to OpenAI (assistants)"]
J --> K["Create or get tenant vector store"]
K --> L["Add file to vector store"]
L --> M["Update DB: tenant_files + vectorStoreId + openaiFileId"]