惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Blog — PlanetScale
Blog — PlanetScale
腾讯CDC
aimingoo的专栏
aimingoo的专栏
Microsoft Azure Blog
Microsoft Azure Blog
A
About on SuperTechFans
J
Java Code Geeks
G
Google Developers Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
罗磊的独立博客
GbyAI
GbyAI
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Solace: A Global Mental Health First Responder Built with...
OLALEKAN OGU · 2026-05-22 · via DEV Community

The Problem Nobody Talks About

970 million people worldwide live with mental health disorders.

But almost every mental health tool built with AI assumes the same user: fast internet, English as a first language, a US or UK phone number to call in a crisis.

That's not 970 million people. That's maybe 50 million.

I'm a developer based in Lagos, Nigeria. When I looked at the mental health AI tools being built, I kept asking the same question: what happens when someone in Accra, Nairobi, Manila, or São Paulo needs help at 2am?

They get a chatbot that tells them to call 988.

That's the gap Solace was built to close.

What is Solace?

Solace is a voice-first, privacy-focused mental health companion powered by Gemma 4. It listens, assesses, and connects people to real help — wherever they are in the world.

Demo Video:

What makes Solace different

1. 🌍 Localized crisis resources for 13+ countries

Most mental health AI tools are built with US resources baked in. If you're not American, you're on your own.

Solace auto-detects your country from your browser timezone and immediately surfaces the right crisis lines, text lines, and chat services for Nigeria, Ghana, Kenya, South Africa, Zimbabwe, India, UK, USA, Canada, Australia, Philippines, Singapore, Brazil — and falls back to international resources for everywhere else.

No settings. No configuration. It just knows.

export function getResourcesByTimezone(): CountryResources {
  const tz = Intl.DateTimeFormat().resolvedOptions().timeZone
  const tzToCountry: Record<string, string> = {
    'Africa/Lagos': 'NG',
    'Africa/Accra': 'GH',
    'Africa/Nairobi': 'KE',
    // ...13+ countries
  }
  const code = tzToCountry[tz]
  return resourcesByCountry[code] ?? resourcesByCountry.DEFAULT
}

Enter fullscreen mode Exit fullscreen mode

2. 🎤 Voice-first input

When someone is in distress, typing is a barrier. Solace has a one-tap voice input powered by the Web Speech API — speak your feelings, Solace listens.

No third-party API. No extra cost. Works in the browser natively.

const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition
recognition.continuous = true
recognition.interimResults = true

Enter fullscreen mode Exit fullscreen mode

3. 🧠 Trauma-informed triage with Gemma 4

Every message is assessed across four triage levels: Low → Moderate → High → Crisis.

Gemma 4's 128K context window and deep instruction-following made it the right model for this. The system prompt is carefully crafted to avoid clinical coldness while still being precise enough to catch crisis signals:

// Triage levels:
// low: mild everyday stress, general worry
// moderate: persistent sadness, sleep issues, social withdrawal  
// high: panic attacks, trauma symptoms, major crisis
// crisis: suicidal ideation, self-harm, immediate danger

Enter fullscreen mode Exit fullscreen mode

At crisis level, the entire UI shifts — emergency resources move to the top, the call button becomes prominent, and the AI's tone changes to prioritize connection to real help over conversation.

4. 📔 Private mood journal

Every check-in is saved to a local mood journal — stored entirely in localStorage. No server. No account. No data leaving the device.

Users can track patterns across sessions: when they tend to feel worse, whether things are improving, what their check-ins look like over time.

5. 📱 Installable PWA

Solace is a Progressive Web App. On mobile, users can install it directly to their home screen — no app store, no download, works in low-bandwidth conditions.

This matters enormously in markets like Nigeria where data costs are high and storage is limited. A 2MB installable app beats a 200MB download every time.

Why Gemma 4 specifically?

This is the question that matters most, so let me be direct.

I chose Gemma 4 31B because:

1. The 128K context window means Solace can hold a full therapeutic conversation — not just one or two turns. Mental health support isn't transactional. People circle back. They contradict themselves. They need to feel heard across a long exchange.

2. Instruction-following precision — the triage system depends on Gemma 4 returning structured JSON reliably, with emotional nuance baked into the summary, patterns, strategies, and affirmation fields. I tested with smaller models. The quality gap was significant.

3. It's open. Gemma 4 can be self-hosted. That means a clinic in Lagos or a NGO in Nairobi could eventually run this on their own infrastructure, with no API costs and full data sovereignty. That's a future worth building toward.

4. Privacy story. Every conversation stays between the user and the model. Solace doesn't log, store, or transmit conversation data. For mental health, that's not a feature — it's a requirement.

Technical Stack

  • Frontend: React + Vite + TypeScript
  • Styling: CSS custom properties, glassmorphism UI, no component library
  • AI: Gemma 4 31B via OpenRouter
  • Voice: Web Speech API (native browser)
  • Storage: localStorage (journal, no server)
  • PWA: Web App Manifest + service worker ready
  • Deploy: Vercel

The hardest part

Building the crisis response flow was the hardest and most important part of this project.

When Gemma 4 returns triageLevel: "crisis", everything changes. The UI shifts to red. The emergency number for the user's country moves above the fold. The AI's system prompt switches to a mode focused entirely on staying present and bridging to real help — not providing therapy.

Getting that balance right — compassionate but not clinical, urgent but not alarming — took more iteration than anything else in the codebase.

What's next

  • Offline-first fallback responses — cached grounding techniques that work with no internet
  • More languages — French, Hausa, Swahili, Portuguese
  • More countries — currently 13, targeting 30+
  • NGO partnership mode — white-label for mental health organizations

Try it

🔗 https://slcai-sm9m.vercel.app/

Open it on your phone. Tap a mood. Speak how you're feeling. See what country resources appear for you.

If you're building in the mental health space or you work with communities that are underserved by current AI tools — I'd love to hear from you in the comments.

Solace is an AI companion, not a therapist or medical service. If you are in crisis, please contact your local emergency services.