TherapistAI: AI-powered mental health support

TherapistAI: AI-powered mental health support

This is a submission for the Cloudflare AI Challenge.

What I Built

TherapistAI is an AI-driven mental health support tool designed to make therapeutic guidance accessible to anyone, regardless of financial means or geographical location. Utilizing Cloudflare’s global infrastructure, the tool offers responsive, empathetic interactions tailored to the user’s emotional needs.

The user experience is designed to be therapeutic and comforting. A voice visualizer displays multiple colors, creating a soothing visual backdrop while background music plays, enhancing the atmosphere. This setting creates a safe space for users to express themselves without fear of judgment.

Demo

https://cf-challenge-therapistai.pages.dev/

My Code

Deployment Steps:

Fork the Repository – Begin by forking this repository to your GitHub account.

Set up Cloudflare Pages – Navigate to your Cloudflare dashboard to create a Pages application with the forked repo. Select the Next.js framework and proceed with the default settings for other configurations.

Configure Environment Variables – Post-setup, add the following encrypted environment variables. These must be configured after the application is initialized, and you may need to retry deployment to activate them

OPENAI_API_KEY – Found on the OpenAI platform API keys section.

Deployment Complete – Your application is now live on Cloudflare!

Local Development:

Clone Your Forked Repo – Clone the repository to your local system.

Add Local Environment Variables – Create a .env.local file in the root directory and add the same environment variables as used in the deployment, formatted as NAME=VALUE.

Install Dependencies – Run pnpm install to install necessary dependencies.

Journey

The genesis of TherapistAI was deeply personal, driven by the tragic loss of my father to depression and the desire to help others in similar situations. Recognizing the barriers to accessing mental health care, especially in economically challenged regions, I embarked on this project.

Developed from the ground up in just one week using open-source technologies like NextJS, HonoJs, and TailwindCSS, this tool represents not just an application, but a commitment to improving mental health accessibility.

This journey began with the integration of text generation models (@cf/qwen/qwen1.5-14b-chat-awq and @hf/nexusflow/starling-lm-7b-beta) to simulate a therapist persona, adding depth and realism to the AI’s responses. Coupled with OpenAI Text-to-Speech (TTS) technology, these responses are given a voice, making the interaction feel more human and engaging. Additionally, the inclusion of the @cf/openai/whisper model for speech recognition enables the system to understand and respond to user inputs more effectively, further enhancing the conversational experience.

This project provided a profound learning experience, especially highlighting how straightforward it is to implement AI functionalities using Cloudflare Workers AI. The seamless integration of complex AI models with Cloudflare’s infrastructure simplified the technical complexities typically associated with such integrations. Additionally, deploying Next.JS to Pages using @cloudflare/next-on-pages facilitated a cohesive full-stack development experience, enabling a smooth integration of frontend and backend services within the Cloudflare ecosystem.

I take great pride in the potential of TherapistAI to make a meaningful difference in people’s lives by providing accessible mental health support. It is deeply gratifying to contribute to a project that could help alleviate the struggles faced by those dealing with mental health issues.

Looking ahead, I plan to explore the integration of AI-generated music to enhance therapeutic engagements, tapping into the profound impact that tailored music can have on mental well-being.

The era of AI is just beginning. Together, we are not just creating technology; we are crafting the future.

Multiple Models and/or Triple Task Types

Task (Triple Task)
Models (Multiple Models)

Chat Session
Qwen1.5-14B Chat AWQ

Whisper

OpenAI Text-to-Speech

Summarize session
Starling LM 7B Beta

Speech Recognition
Whisper

Leave a Reply

Your email address will not be published. Required fields are marked *