Image Library Flow (Admin)
This flow shows how images are stored in S3 and indexed for retrieval in chat.
Key Steps
- Upload an image in Admin → Images with title and description.
- Server uploads the image to S3 and builds JSON metadata.
- JSON metadata is uploaded to OpenAI and indexed in the image vector store.
- DB record is updated with S3 info and vector store ID.
Mermaid Flow
flowchart TD
A["Admin Panel: Image Library"] --> B["Select image + title + description"]
B --> C["POST /api/admin/tenant/{tenantId}/images/upload"]
C --> D["Upload image to S3"]
D --> E["Create image metadata JSON"]
E --> F["Upload JSON to OpenAI (purpose: assistants)"]
F --> G["Create or get image vector store"]
G --> H["Add JSON file to image vector store"]
H --> I["Update DB: tenant_images + imageVectorStoreId + openaiFileId"]