Skip to content

yunhanluo/empathy-exchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

107 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Empathy Exchange

An AI-powered Flutter application designed to foster kindness and empathy in digital communication. Empathy Exchange uses OpenAI's GPT-5.2 to evaluate conversations in real-time, rewarding positive interactions through a karma system and creating a safer, more supportive online environment.

🌟 Features

  • AI-Powered Conversation Analysis: Real-time evaluation of messages for empathy, kindness, and positivity using OpenAI GPT-5.2
  • Karma System: Gamified positive reinforcement with karma points (-10 to +10) based on message quality
  • Profanity Filter: Automatic detection and filtering of inappropriate content
  • Real-Time Chat: Live messaging powered by Firebase Realtime Database
  • Karma History Visualization: Interactive charts showing karma trends over time
  • User Profiles: Customizable profiles with pictures, bios, and display names
  • Badge System: Users can give and receive badges recognizing positive contributions
  • Cross-Platform: Works on Web, iOS, and Android

πŸ› οΈ Tech Stack

  • Frontend: Flutter (Dart)
  • Backend Services:
    • Firebase Authentication
    • Firebase Realtime Database
    • Cloud Firestore
    • Firebase Storage
  • AI Integration: OpenAI GPT-5.2 API
  • Additional Libraries:
    • Google Fonts
    • fl_chart (data visualization)
    • HTTP client for API communication

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

πŸš€ Getting Started

1. Clone the Repository

git clone <repository-url>
cd empathy-exchange

2. Install Dependencies

flutter pub get

3. Firebase Setup

  1. Create a Firebase project at Firebase Console
  2. Enable the following services:
    • Authentication (Email/Password and Google Sign-In)
    • Realtime Database
    • Cloud Firestore
    • Storage
  3. Download configuration files:
    • For Android: google-services.json β†’ place in android/app/
    • For iOS: GoogleService-Info.plist β†’ place in ios/Runner/
    • For Web: Add Firebase config to lib/main.dart (already configured)

4. Environment Configuration

Create a .env file in the root directory:

FIREBASE_API_KEY=your_firebase_api_key
OPENAI_API_KEY=your_openai_api_key

The .env file is already configured in pubspec.yaml to be included as an asset.

5. OpenAI API Setup

  1. Sign up for an OpenAI account at OpenAI Platform
  2. Create an API key
  3. Add the key to your .env file

6. Run the Application

# For web
flutter run -d chrome

# For iOS (requires macOS and Xcode)
flutter run -d ios

# For Android (requires Android Studio/Android SDK)
flutter run -d android

πŸ“ Project Structure

empathy-exchange/
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ main.dart                 # App entry point
β”‚   β”œβ”€β”€ firebase_options.dart     # Firebase configuration
β”‚   β”œβ”€β”€ screens/                  # App screens
β”‚   β”‚   β”œβ”€β”€ chat_screen.dart
β”‚   β”‚   β”œβ”€β”€ login_screen.dart
β”‚   β”‚   β”œβ”€β”€ profile_screen.dart
β”‚   β”‚   └── signup_screen.dart
β”‚   β”œβ”€β”€ services/                 # Business logic
β”‚   β”‚   β”œβ”€β”€ auth_service.dart
β”‚   β”‚   β”œβ”€β”€ fcm_service.dart
β”‚   β”‚   β”œβ”€β”€ openai_service.dart
β”‚   β”‚   β”œβ”€β”€ profanity_check.dart
β”‚   β”‚   └── profile_service.dart
β”‚   └── widgets/                  # Reusable widgets
β”‚       β”œβ”€β”€ material.dart
β”‚       β”œβ”€β”€ message.dart
β”‚       β”œβ”€β”€ profile_picture_widget.dart
β”‚       └── sidetooltip.dart
β”œβ”€β”€ python/                       # Python scripts (optional)
β”‚   β”œβ”€β”€ chat_bot.py
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── SETUP.md
β”œβ”€β”€ android/                      # Android-specific files
β”œβ”€β”€ ios/                          # iOS-specific files
β”œβ”€β”€ web/                          # Web-specific files
└── pubspec.yaml                  # Flutter dependencies

πŸ€– How the AI Works

Conversation Evaluation

The AI system evaluates conversations through a multi-stage process:

  1. Message Collection: Every 5 messages (or on manual trigger), the system collects recent conversation history
  2. Context Building: The AI receives both recent messages and an existing conversation summary to maintain context
  3. Evaluation: Messages are analyzed for:
    • Tone and language
    • Constructiveness
    • Respectfulness
    • Overall positive or negative impact
  4. Karma Assignment: Points are assigned from -10 (very negative) to +10 (very positive)
  5. Feedback: Evaluation results are posted as system messages with reasoning

Profanity Detection

A custom pattern-based profanity filter:

  • Scans messages for inappropriate content
  • Automatically deducts karma points
  • Censors inappropriate language
  • Maintains a comprehensive database of encoded profanity patterns

🎯 Key Features Explained

Karma System

  • Users receive karma points based on message quality
  • Points range from -10 to +10 per evaluation
  • Accounts with karma below -100 are automatically terminated
  • Karma history is visualized through interactive charts

Real-Time Chat

  • Powered by Firebase Realtime Database
  • Supports multiple concurrent users
  • Automatic AI evaluation every 5 messages
  • Manual evaluation triggers for chat owners

User Profiles

  • Customizable display names and bios
  • Profile picture upload
  • Karma history visualization
  • Badge system for recognition

πŸ”’ Security & Privacy

  • User authentication through Firebase
  • Minimal data sent to external APIs (only necessary conversation context)
  • Secure storage of API keys in environment variables
  • Account termination for users with excessive negative karma

🀝 Contributing

This project is open source. Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“ License

Open Source - See LICENSE file for details

πŸ† Project Status

Status: Active Development (Alpha Version)
Platform: Web, iOS, Android
Developed for: 2025 Presidential AI Challenge

Video Link

Click this link to watch a demo of the app's main features

πŸ“ž Support

For questions or issues, please open an issue in the repository.


Empathy Exchange - Building a kinder digital world, one conversation at a time. πŸ’™

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •