How alexey-obukhov/psy-supabase works
Psy-Supabase is a psychological-support chatbot backend that combines Supabase-backed knowledge and interaction history with retrieval, recurring-theme detection, and therapeutic response generation. Its user workflow enters through the chat API, initializes model and database services, processes the question with RAG and psychological analysis, then returns a generated response. The graph also preserves documented embedding/vector search, associative memory, emotion and topic analysis, prompt selection, and safety capabilities. Relationship evidence comes from the excerpts, SOURCE INDEX references, and README; unsampled implementation details are not assumed.
Main entry points: rag_processor.py RAG processor · main.py Chat API · database.py Database manager · pain_point_detector.py Pain detection
Components 21
Chat entry
- Chat API
psy_supabase/main.py - Runtime config
psy_supabase/config.py
Retrieval and memory
- RAG processor
psy_supabase/core/rag_processor.py - Dynamic retrieval
psy_supabase/core/dynamic_rag.py - Context selection
psy_supabase/rag/context_determination.py - Associative memory
psy_supabase/memory/associative_memory.py - Database manager
psy_supabase/core/database.py - Embedding utilities
psy_supabase/utilities/embedding_utils.py - Vector utilities
psy_supabase/utilities/vector_utils.py
Psychological analysis
- Pain detection
psy_supabase/core/pain_point_detector.py - Emotion analysis
psy_supabase/utilities/semantic_emotion_detector.py - Text analysis
psy_supabase/utilities/nlp_utils.py - Therapeutic mappings
psy_supabase/utilities/therapeutic_mappings.py
Response generation
- Model manager
psy_supabase/core/model_manager.py - Response builder
psy_supabase/core/response_generator.py - Text generator
psy_supabase/core/text_generator.py - Prompt selection
psy_supabase/utilities/prompt_selector.py - Safety checks
psy_supabase/utilities/safety_handler.py - Therapy templates
psy_supabase/utilities/templates/therapeutic_prompt.py
Other components
- User
- Supabase store
Connections 28
- User → Chat API: sends question
psy_supabase/main.py - Chat API → Database manager: uses database
psy_supabase/main.py - Chat API → Model manager: gets generator
psy_supabase/main.py - Chat API → RAG processor: creates processor
psy_supabase/main.py - Chat API → Pain detection: tracks pain points
psy_supabase/main.py - Chat API → Runtime config: reads settings
psy_supabase/main.py - Database manager → Supabase store: reads and writes
- RAG processor → Database manager: retrieves context
psy_supabase/core/rag_processor.py - RAG processor → Dynamic retrieval: requests retrieval
psy_supabase/core/rag_processor.py - RAG processor → Context selection: uses context
psy_supabase/core/rag_processor.py - RAG processor → Associative memory: uses memory
psy_supabase/core/rag_processor.py - RAG processor → Embedding utilities: processes embeddings
psy_supabase/core/rag_processor.py - RAG processor → Model manager: uses models
psy_supabase/core/rag_processor.py - Dynamic retrieval → Database manager: queries history
psy_supabase/core/dynamic_rag.py - Pain detection → Database manager: checks patterns
psy_supabase/core/pain_point_detector.py - Pain detection → Emotion analysis: analyzes emotion
psy_supabase/core/pain_point_detector.py - Pain detection → Text analysis: analyzes text
psy_supabase/core/pain_point_detector.py - Pain detection → Therapeutic mappings: uses themes
psy_supabase/core/pain_point_detector.py - Context selection → Database manager: queries vectors
psy_supabase/rag/context_determination.py - Context selection → Vector utilities: uses vector tools
psy_supabase/rag/context_determination.py - Model manager → Text generator: provides generator
psy_supabase/core/model_manager.py - RAG processor → Response builder: uses response builder
psy_supabase/core/rag_processor.py - Response builder → Text generator: generates text
psy_supabase/core/response_generator.py - Response builder → Prompt selection: selects prompt
psy_supabase/core/response_generator.py - Text generator → Prompt selection: selects prompt
psy_supabase/core/text_generator.py - Text generator → Therapy templates: uses templates
psy_supabase/core/text_generator.py - Text generator → Safety checks: checks safety
- Therapeutic mappings → Emotion analysis: standardizes themes
psy_supabase/utilities/semantic_emotion_detector.py