How phantom-1111/mental-health-ai-chatbot works
This is a mental-health chatbot: a user submits text through either the API or interactive demo, the combined analyzer derives sentiment, emotion, and safety signals, and the response generator uses that analysis and conversation history to produce a supportive reply. The sampled API confirms the analysis and response calls; classifier implementations for sentiment and emotion were not sampled, so their internal model details are omitted.
Main entry points: main.py Chat API · analyze.py Combined analyzer · response.py Response generator · demo.py Terminal demo
Components 10
Chat interaction
- Chat API
api/main.py - Terminal demo
demo.py - Conversation history
api/main.py
Text analysis
- Combined analyzer
ml/combined/analyze.py - Sentiment analysis
ml/sentiment/predict_function.py - Emotion analysis
ml/emotion/predict_function.py - Safety analysis
ml/safety/predict_function.py
Response generation
- Response generator
llm/response.py
Other components
- User
- Groq chat service
Connections 13
- User → Chat API: submits message
- User → Terminal demo: enters text
- Chat API → Combined analyzer: analyzes text
- Terminal demo → Combined analyzer: analyzes text
- Combined analyzer → Sentiment analysis: calls
- Combined analyzer → Emotion analysis: calls
- Combined analyzer → Safety analysis: calls
- Chat API → Response generator: requests reply
- Terminal demo → Response generator: requests reply
- Chat API → Conversation history: updates
- Chat API → Response generator: passes history
- Terminal demo → Response generator: passes history
- Response generator → Groq chat service: requests completion