Created on 18th May 2025
•
MindMate is an AI-powered mental health companion designed to
provide emotional support through intelligent, empathetic, and
multilingual conversations. It helps users manage their mental wellbeing by combining natural language processing with real-time
emotion detection using facial expressions. MindMate can chat in
regional languages like Hindi, Kannada, Telugu, and English, making it
accessible to a wide range of users. It tracks emotional trends over
time, offers personalized self-assessment quizzes, and sends helpful
reminders for activities like meditation or journaling. With a focus on
privacy, user control, and inclusivity, MindMate aims to make mental
health support more understanding, personal, and available to
everyone.
Challenges We Ran Into
Router Prefix & 404 Errors in FastAPI
Issue: Many endpoints (e.g., /quizapp/generate_quiz, /emotion/latest, /) returned 404 because routers weren’t mounted with the correct prefixes, and there was no root route defined.
Resolution: Consolidated all include_router calls in main.py with proper prefixes (/quizapp, /chatbot), added a simple @app.get("/") root handler, and updated frontend fetch URLs to hit http://localhost:8000/quizapp/... and http://localhost:8000/chatbot/.... Verified each endpoint via curl before retesting the UI.
await in Non-async React Function
Issue: The QuizPage build failed with “Unexpected reserved word await” because handleSubmit wasn’t declared async.
Resolution: Added async to the handleSubmit arrow function, ensured proper try/catch/finally syntax, and ran a local type-check to catch similar errors early.
Frontend vs. Backend Route Confusion
Issue: React routes like /quiz and /chat were being requested from the FastAPI server (port 8000) instead of the React dev server (port 3000/5173), causing “Not Found” errors.
Resolution: Scoped API calls to absolute URLs (http://localhost:8000/...) and reserved /quiz & /chat for client-side navigation. Optionally set up a Vite proxy during development to simplify paths.
Oversized Prompts & Token Truncation
Issue: Injecting entire quiz_results.csv and full emotion history sometimes exceeded Google Gemini’s context window, leading to truncated or ignored context.
Resolution: Implemented a prompt-length guard—truncated the quiz text to ~1,500 characters and capped the emotion list to the latest 10 entries. Added logging of the final prompt snippet to verify what was actually sent.
Git Push Rejection (“Non-Fast-Forward” Errors)
Issue: git push failed because the remote main branch had commits not present locally.
Resolution: Pulled remote changes with git pull --rebase, resolved merge conflicts, then either fast-forwarded or, when appropriate, used git push --force aft