How rengha93/ai-bill-analyzer works
AI Bill Analyzer lets users upload telecom bills, then ask session-scoped questions across them. Upload processing extracts PDF text, indexes chunks for semantic retrieval, and separately extracts typed bill data for exact summaries and comparisons. Chat combines retrieved context with model-selected data tools and optional web search, then streams answers to the UI. The graph reflects the documented pipeline and sampled call sites; unsampled component internals are represented only where the tree and available references support them.
Main entry points: embedBills.ts Bill processing action · Workspace.tsx Workspace · route.ts Chat API · tools.ts Bill data tools
Components 19
User interface
- Dashboard page
app/page.tsx - Workspace
app/components/Workspace.tsx - Bill dropzone
app/components/DropzoneUI.tsx - Chat interface
app/components/ChatBarUI.tsx
Bill ingestion
- Bill processing action
actions/embedBills.ts - PDF text extraction
actions/embedBills.ts - Text chunking
lib/chunker.ts - Text embeddings
lib/embedding.ts - Bill data schema
lib/schema.ts
Chat and retrieval
- Chat API
app/api/chat/route.ts - Semantic retrieval
app/api/chat/route.ts - Gemini agent
app/api/chat/route.ts - Bill data tools
lib/tools.ts - Market plan search
lib/tools.ts
Data and integrations
- Vector index
lib/pinecone.ts - Bill database
lib/mongodb.ts
Other components
- Bill analyst
- Google Gemini
- Tavily search
Connections 25
- Bill analyst → Dashboard page: opens
README.md - Dashboard page → Workspace: renders
app/page.tsx - Workspace → Bill dropzone: renders
app/components/Workspace.tsx - Workspace → Chat interface: renders
app/components/Workspace.tsx - Bill dropzone → Workspace: selects files
app/components/Workspace.tsx - Chat interface → Workspace: submits questions
app/components/Workspace.tsx - Workspace → Bill processing action: uploads bills
app/components/Workspace.tsx - Bill processing action → PDF text extraction: extracts text
actions/embedBills.ts - Bill processing action → Text chunking: chunks text
actions/embedBills.ts - Bill processing action → Text embeddings: embeds chunks
actions/embedBills.ts - Bill processing action → Vector index: upserts vectors
actions/embedBills.ts - Bill processing action → Bill data schema: validates extraction
actions/embedBills.ts - Bill processing action → Google Gemini: extracts bill data
actions/embedBills.ts - Bill processing action → Bill database: stores bill records
actions/embedBills.ts - Workspace → Chat API: sends chat requests
app/components/Workspace.tsx - Chat API → Semantic retrieval: retrieves context
app/api/chat/route.ts - Semantic retrieval → Text embeddings: embeds query
app/api/chat/route.ts - Semantic retrieval → Vector index: queries vectors
app/api/chat/route.ts - Chat API → Gemini agent: streams response
app/api/chat/route.ts - Gemini agent → Google Gemini: generates answer
app/api/chat/route.ts - Gemini agent → Bill data tools: dispatches tools
app/api/chat/route.ts - Bill data tools → Bill database: reads bill data
lib/tools.ts - Bill data tools → Market plan search: offers market lookup
lib/tools.ts - Market plan search → Tavily search: searches plans
lib/tools.ts - Chat API → Chat interface: streams answers