How shivshaktisahoo/ai-medical-chatbot works
AI Medical Chatbot is a browser-based multimodal health-guidance assistant. A user enters through the landing page, opens chat, selects a doctor voice, and submits text, a recording, and optionally an image. The backend transcribes audio, generates grounded guidance with provider fallbacks, synthesizes speech, and returns text, audio, and any degradation notice for display and playback. The map includes the documented landing, theme, doctor-selection, and rate-limiting capabilities. Backend call details are supported by excerpts; browser-to-API and provider relationships also use README documentation.
Main entry points: consult.py Consult endpoint · Chat.tsx Chat page · ChatPanel.tsx Chat panel · Landing.tsx Landing page
Components 26
Browser experience
- App routes
frontend/src/App.tsx - Landing page
frontend/src/pages/Landing.tsx - GitHub mark
frontend/src/components/GithubMark.tsx - Chat page
frontend/src/pages/Chat.tsx - Theme state
frontend/src/hooks/useTheme.ts
Chat interaction
- Doctor voice choice
frontend/src/hooks/useDoctorVoice.ts - Doctor illustration
frontend/src/components/DoctorIllustration.tsx - Chat panel
frontend/src/components/ChatPanel.tsx - Message composer
frontend/src/components/Composer.tsx - Audio recorder
frontend/src/hooks/useAudioRecorder.ts - API client
frontend/src/lib/api.ts - Message bubble
frontend/src/components/MessageBubble.tsx - Audio player
frontend/src/components/AudioPlayer.tsx
Consult API
- Consult endpoint
backend/app/routers/consult.py - Response schemas
backend/app/schemas.py - FastAPI app
backend/app/main.py
AI and speech
- Speech transcription
backend/app/services/stt.py - Guidance and vision
backend/app/services/llm.py - Speech synthesis
backend/app/services/tts.py - Local responder
backend/app/services/llm.py
Configuration and safeguards
- Provider settings
backend/app/config.py - IP rate limit
backend/app/ratelimit.py
Other components
- Visitor
- Groq services
- OpenRouter
- Speech providers
Connections 34
- Visitor → Landing page: opens
README.md - App routes → Landing page: routes to
frontend/src/App.tsx - App routes → Chat page: routes to
frontend/src/App.tsx - Landing page → Chat page: starts consultation
README.md - Chat page → Landing page: returns home
README.md - Landing page → GitHub mark: renders
frontend/src/pages/Landing.tsx - Chat page → Theme state: uses
frontend/src/pages/Chat.tsx - Chat page → Doctor voice choice: selects voice
frontend/src/pages/Chat.tsx - Chat page → Doctor illustration: renders
frontend/src/pages/Chat.tsx - Chat page → Chat panel: renders
frontend/src/pages/Chat.tsx - Chat panel → Message composer: renders
frontend/src/components/ChatPanel.tsx - Message composer → Audio recorder: records audio
frontend/src/components/Composer.tsx - Chat panel → API client: submits turn
frontend/src/components/ChatPanel.tsx - API client → Consult endpoint: posts multipart turn
README.md - Consult endpoint → IP rate limit: applies limit
backend/app/routers/consult.py - Consult endpoint → Speech transcription: transcribes audio
backend/app/routers/consult.py - Consult endpoint → Guidance and vision: generates reply
backend/app/routers/consult.py - Consult endpoint → Speech synthesis: synthesizes reply
backend/app/routers/consult.py - Consult endpoint → Response schemas: returns schema
backend/app/routers/consult.py - Speech transcription → Groq services: transcribes with
README.md - Guidance and vision → Groq services: tries first
backend/app/services/llm.py - Guidance and vision → OpenRouter: falls back to
backend/app/services/llm.py - Guidance and vision → Local responder: falls back to
backend/app/services/llm.py - Speech synthesis → Speech providers: synthesizes with fallbacks
README.md - FastAPI app → Consult endpoint: registers router
backend/app/main.py - FastAPI app → Provider settings: configures CORS
backend/app/main.py - FastAPI app → IP rate limit: installs middleware
backend/app/main.py - Consult endpoint → Provider settings: reads settings
backend/app/routers/consult.py - Chat panel → Message bubble: renders messages
frontend/src/components/ChatPanel.tsx - Message bubble → Audio player: renders playback
frontend/src/components/MessageBubble.tsx - Message bubble → Doctor illustration: renders avatar
frontend/src/components/MessageBubble.tsx - Chat panel → Doctor voice choice: uses voice choice
frontend/src/components/ChatPanel.tsx - Doctor illustration → Doctor voice choice: uses gender type
frontend/src/components/DoctorIllustration.tsx - Chat panel → Consult endpoint: receives response
README.md