How yangzhangscut2025/ai-insurance works
AI 未来保险 is a Flask insurance assistant with three main user journeys: personalized insurance Q&A (including uploaded-plan summarization), role-play sales practice with optional speech, and document-grounded RAG answers. Account, profile, role, and conversation data support those journeys; invitation email and onboarding UI are additional capabilities. The map follows documented features and sampled route/service calls; several subsystems are represented at their documented source paths because their implementation was not sampled.
Main entry points: views.py Assistant routes · rag.py Hybrid RAG engine · models.py User and chat records · templates Chat interface
Components 22
Web and accounts
- Flask application
app/__init__.py - Authentication
app/auth/views.py - Chat interface
app/templates - Assistant routes
app/main/views.py - Input forms
app/main/forms.py - Invitation mailer
app/main/send.py
Insurance assistant
- Profile capture
app/main/views.py - Insurance agent
app/main/agent.py - Plan upload and summary
app/main/views.py
Sales practice
- Custom role setup
app/main/views.py - Role-play agent
app/main/agent.py - Speech synthesis
app/main/audio.py
Knowledge and state
- RAG routes
app/main/views.py - Hybrid RAG engine
app/main/rag.py - Insurance documents
- BGE embeddings
app/main/rag.py - ChromaDB index
- User and chat records
app/models.py
Other components
- User
- Qwen / DashScope
- DashScope TTS
- SMTP service
Connections 28
- User → Chat interface: uses
- Chat interface → Authentication: signs in
- Authentication → User and chat records: reads users
- Flask application → Assistant routes: registers routes
- Flask application → Authentication: registers routes
- Chat interface → Assistant routes: submits requests
- Assistant routes → Input forms: validates input
- Assistant routes → Profile capture: saves profile
- Profile capture → User and chat records: writes profile
- Assistant routes → User and chat records: stores answers
- Assistant routes → Insurance agent: queries
- Insurance agent → Qwen / DashScope: runs assistant
- Assistant routes → Plan upload and summary: handles upload
- Plan upload and summary → Qwen / DashScope: summarizes plan
- Assistant routes → Custom role setup: creates role
- Custom role setup → User and chat records: writes role
- Assistant routes → Role-play agent: sends dialogue
- Role-play agent → Qwen / DashScope: runs assistant
- Assistant routes → Speech synthesis: requests speech
- Speech synthesis → DashScope TTS: synthesizes audio
- Assistant routes → RAG routes: serves RAG actions
- RAG routes → Hybrid RAG engine: queries or rebuilds
- Hybrid RAG engine → Insurance documents: loads documents
- Hybrid RAG engine → BGE embeddings: embeds chunks
- Hybrid RAG engine → ChromaDB index: indexes and searches
- Hybrid RAG engine → Qwen / DashScope: generates answer
- Assistant routes → Invitation mailer: sends invitation
- Invitation mailer → SMTP service: sends mail