How bhv1122/generative-ai- works
This Flask web app provides authenticated, stateful AI chat, with account settings and conversation history. The main workflow is: a user signs in, submits a nonblank message, the app stores it and loads recent history, then sends the prompt and context to Gemini and returns a reply. MongoDB holds user and session records; the persistence layer also exposes bounded history retrieval. The excerpts confirm OAuth providers and theme syncing. Chat UI wiring and some route implementations were not sampled, so their internal links are omitted where uncertain.
Main entry points: app.py Flask routes · chat.html Browser UI · database.py Persistence helpers · main.js Theme client
Components 11
Web interface
- Browser UI
templates/chat.html - Sign-in and account views
templates/login.html - Account view
templates/account.html - Theme client
static/js/main.js
Flask application
- Flask routes
app.py
Persistence
- Persistence helpers
database.py - MongoDB or mock store
database.py
External services
- Gemini API
- Google OAuth
- GitHub OAuth
Other components
- User
Connections 11
- User → Browser UI: uses
- Browser UI → Flask routes: sends requests
- Flask routes → Sign-in and account views: renders
- Flask routes → Account view: renders
- Flask routes → Browser UI: returns responses
- Theme client → Flask routes: syncs theme
- Flask routes → Persistence helpers: calls persistence
- Persistence helpers → MongoDB or mock store: reads and writes
- Flask routes → Gemini API: sends chat prompt
- Flask routes → Google OAuth: authorizes sign-in
- Flask routes → GitHub OAuth: authorizes sign-in