How bhushanchavan04/adinsight-ai----marketing-analytics-rag-chatbot works
AdInsight AI lets a marketing analyst upload a PDF or CSV campaign report, then ask questions and receive context-grounded answers. The upload path parses and chunks the report, builds an in-memory FAISS index, and reports indexing metadata; the chat path retrieves relevant chunks and sends a prompt to Gemini. The React interface includes upload, chat, status, suggested questions, and message rendering. The graph follows shown calls and documented endpoints; reset is an API capability, while the UI reset shown only clears local state.
Main entry points: main.py FastAPI Endpoints · rag_pipeline.py RAG Pipeline · App.jsx Application Shell · ChatWindow.jsx Chat Window
Components 15
Analyst Interface
- Application Shell
frontend/src/App.jsx - Report Uploader
frontend/src/components/FileUploader.jsx - Chat Window
frontend/src/components/ChatWindow.jsx - Report Sidebar
frontend/src/components/Sidebar.jsx - Message Renderer
frontend/src/components/MessageBubble.jsx
API And Session
- FastAPI Endpoints
backend/main.py - In-Memory Session
backend/main.py
Report Indexing
- PDF CSV Parser
backend/file_parser.py - Text Chunking
backend/file_parser.py - FAISS Vector Store
backend/vector_store.py - HuggingFace Embeddings
Retrieval And Answers
- RAG Pipeline
backend/rag_pipeline.py - Gemini Handler
backend/llm_handler.py
Other components
- Marketing Analyst
- Gemini Model API
Connections 23
- Marketing Analyst → Report Uploader: selects report
frontend/src/components/FileUploader.jsx - Report Uploader → FastAPI Endpoints: uploads file
frontend/src/components/FileUploader.jsx - FastAPI Endpoints → PDF CSV Parser: parses bytes
backend/main.py - PDF CSV Parser → Text Chunking: splits text
backend/file_parser.py - FastAPI Endpoints → RAG Pipeline: builds index
backend/main.py - RAG Pipeline → FAISS Vector Store: creates store
backend/rag_pipeline.py - FAISS Vector Store → HuggingFace Embeddings: embeds chunks
backend/vector_store.py - FastAPI Endpoints → In-Memory Session: stores index metadata
backend/main.py - Marketing Analyst → Chat Window: asks question
frontend/src/components/ChatWindow.jsx - Chat Window → FastAPI Endpoints: posts question
frontend/src/components/ChatWindow.jsx - FastAPI Endpoints → In-Memory Session: checks index
backend/main.py - FastAPI Endpoints → RAG Pipeline: queries index
backend/main.py - RAG Pipeline → FAISS Vector Store: retrieves chunks
backend/rag_pipeline.py - RAG Pipeline → Gemini Handler: generates answer
backend/rag_pipeline.py - Gemini Handler → Gemini Model API: calls model
backend/llm_handler.py - FastAPI Endpoints → Chat Window: returns answer
frontend/src/components/ChatWindow.jsx - Chat Window → Message Renderer: renders messages
frontend/src/components/ChatWindow.jsx - Application Shell → Report Uploader: renders upload
frontend/src/App.jsx - Application Shell → Chat Window: renders chat
frontend/src/App.jsx - Application Shell → Report Sidebar: renders status
frontend/src/App.jsx - Report Sidebar → Application Shell: requests local reset
frontend/src/App.jsx - Marketing Analyst → Application Shell: uses interface
- Marketing Analyst → FastAPI Endpoints: requests session reset
README.md