DEV Community

Monisha14206
Monisha14206

Posted on

When You Need Me 💛 — A Private AI Companion Built for a Friend

What I Built

When You Need Me 💛

When You Need Me is a private AI companion built for a real friend.

Sometimes someone we care about wants to talk, share how they feel, or simply have someone listen — but we may be busy, unavailable, or unable to respond immediately.

I built this project to create a small bridge during those moments.

Instead of building another generic chatbot, I wanted the AI to understand how I communicate and combine that with what I know about my friend.

The system can:

  • Analyze an approved sample of my conversations to create a communication-style profile
  • Learn my tone, vocabulary, sentence style, emoji usage, humor, language mixing, and support style
  • Build a friend profile based on information I choose to provide
  • Generate responses using the communication style + friend profile + current conversation
  • Explain why a response feels like my communication style
  • Run the AI locally using an open-weight model
  • Provide safety handling for conversations involving serious distress
  • Allow users to delete stored chats, profiles, memory, and other personal data

Most importantly, the AI does not pretend to actually be me. It clearly identifies itself as an AI companion inspired by my communication style.


Demo

🌐 Live UI Demo

https://monisha14206.github.io/when-you-need-me/

The GitHub Pages version demonstrates the frontend experience.

🎥 Full AI Demo

The complete AI experience runs locally with Ollama and an open-weight model.

Demo video: https://drive.google.com/file/d/1tFId9IJMRS3d-3FGy0tEpueLhSw4rFPG/view?usp=sharing


Code

GitHub Repository

https://github.com/Monisha14206/when-you-need-me

The repository contains the complete frontend, backend, safety system, local AI integration, demo data, tests, and setup instructions.


How I Built It

Tech Stack

Frontend

  • React
  • Vite
  • JavaScript
  • CSS

Backend

  • Python
  • FastAPI
  • SQLite

AI

  • Ollama
  • llama3.2:3b
  • Open-weight local inference

Other

  • Local-first data storage
  • Rule-based safety layer
  • Communication-style analysis
  • Friend profile and memory system

How It Works

The basic architecture is:

             ┌─────────────────────┐
             │       Friend        │
             └──────────┬──────────┘
                        │
                        ▼
             ┌─────────────────────┐
             │   React Frontend    │
             └──────────┬──────────┘
                        │
                        ▼
             ┌─────────────────────┐
             │    FastAPI Backend  │
             └──────────┬──────────┘
                        │
            ┌───────────┼───────────┐
            ▼           ▼           ▼
      ┌──────────┐ ┌──────────┐ ┌──────────┐
      │  Style   │ │  Friend  │ │  Safety  │
      │ Analysis │ │  Profile │ │   Layer  │
      └────┬─────┘ └────┬─────┘ └────┬─────┘
           │            │            │
           └────────────┼────────────┘
                        ▼
             ┌─────────────────────┐
             │  Ollama / LLM       │
             │  llama3.2:3b        │
             └──────────┬──────────┘
                        │
                        ▼
             ┌─────────────────────┐
             │ Personalized Reply  │
             └─────────────────────┘
Enter fullscreen mode Exit fullscreen mode

1. Communication Style

The user can provide an approved conversation sample.

Instead of sending the entire conversation to a cloud AI service, the application extracts useful communication patterns such as:

  • Tone
  • Sentence length
  • Vocabulary
  • Emoji usage
  • Punctuation
  • Humor
  • English/Telugu mixing
  • Listening style
  • Reassurance and advice style

These are converted into a communication-style profile.

2. Friend Profile

The user can optionally provide information about their friend, such as:

  • Personality
  • Interests
  • What makes them happy
  • What makes them upset
  • Preferred support style
  • Humor preferences
  • Topics to avoid
  • Important boundaries

3. Response Generation

The AI combines:

Communication Style
+
Friend Profile
+
Current Conversation
+
Approved Memory
+
Safety Rules
↓
Local Open-Weight LLM
↓
Personalized AI Response

4. Explainability

The application can also explain why a response feels similar to the user's communication style.

For example:

Casual conversational tone
Uses familiar expressions
Short supportive sentences
Matches the user's emoji style

This makes the personalization more transparent instead of simply saying that the AI "knows" the user.

5. Safety

The application includes a safety layer that classifies conversations into different levels of emotional distress.

For potentially serious crisis situations, the application does not simply let the language model generate an unrestricted response.

Instead, the safety layer can intervene and provide a predefined supportive response that encourages reaching out to trusted people and appropriate emergency/professional support.

The AI is also explicitly designed not to encourage emotional dependency.

It should never tell someone that they only need the AI or that the AI is their only source of support.


Why Does Open Innovation Matter?

I chose open-source AI because this project deals with something extremely personal: private conversations and relationships.

Using a closed cloud AI API would mean sending potentially sensitive conversations to an external service.

With a local open-weight model, the project can instead run the inference on the user's own computer.

This provides:

🔒 Privacy

Personal conversations can remain local.

🛠️ Control

The developer can inspect and modify how the system works.

🧠 Customization

The AI experience can be designed specifically for one person's communication style and use case.

💰 Accessibility

The project does not require a paid proprietary AI API to function.

🌍 Open Innovation

Open models and tools make it possible for students and independent developers to experiment with AI applications that would otherwise require expensive infrastructure or proprietary services.

For this project, open innovation is not just about using free software.

It gives me more control over where personal data goes, how the AI behaves, and how the system can be changed.


Privacy & Safety

Privacy is a core part of the project.

The project is designed around:

  • Local AI inference
  • No OpenAI/Claude/Gemini API
  • No real private conversations in the repository
  • Fictional demo data
  • Data deletion controls
  • Transparent AI identity
  • Safety rules for high-risk conversations
  • No encouragement of emotional dependency

The AI is not a therapist and does not replace real human support.

It is intended to provide a temporary supportive interaction while encouraging connection with real people when needed.


What I Learned

Building this project taught me that creating an AI application is not only about getting a model to generate a response.

The harder questions were:

  • What personal data does the AI actually need?
  • What information should never be sent to the model?
  • How can personalization happen without training a model?
  • How do you prevent an AI from pretending to be a real person?
  • What should happen when a conversation becomes unsafe?
  • How can users understand why an AI generated a particular response?

These questions influenced the architecture as much as the choice of model.


Challenges

The biggest challenge was balancing personalization and privacy.

I wanted the AI to feel familiar without simply feeding a person's entire chat history into an LLM.

The solution was to separate:

Raw Conversation
       ↓
Communication Analysis
       ↓
Communication Profile
       ↓
AI Prompt
Enter fullscreen mode Exit fullscreen mode

This allows the application to use communication patterns without continuously sending the original private conversation to the model.

Another challenge was safety. A general-purpose LLM should not be responsible for making every safety decision, so I added a separate safety layer before response generation.


Future Improvements

Some improvements I would like to explore:

  • Better multilingual support
  • More sophisticated communication-style analysis
  • Optional voice interaction
  • Improved long-term memory controls
  • More granular privacy settings
  • Additional open-weight models
  • Better mobile experience
  • More explainable personalization
  • Optional encrypted local storage

My Agent Session

Optional

If you used an AI coding agent while building the project, I will include my agent session / development process here.


Prize Categories

Primary category: Open Source AI / AI Application

The project uses an open-weight model through Ollama and keeps the core AI functionality local rather than depending on a proprietary cloud AI API.


Final Note

I built When You Need Me for a simple reason:

Sometimes the person you want to talk to isn't available immediately.

I don't want an AI to replace that person.

I wanted to build something that can make the waiting period feel a little less lonely — while still being honest that it is an AI, keeping personal data under the user's control, and encouraging real human connection when it matters.

When you need me, even when I'm not immediately there. 💛

Top comments (0)