Projects
Life & Journey

Ai-chan: An Emotionally Intelligent AI Companion

2024-12-15

Ai-chan - The Romantic AI Companion

Ai-chan is an advanced Line Messaging Bot that transcends simple automated responses. By integrating state-of-the-art Large Language Models (LLMs) with real-time sentiment analysis, Ai-chan provides a warm, empathetic, and context-aware conversational experience for users seeking companionship and emotional support.

🌟 Core Features

  • Empathetic Dialogue Engine: Utilizes Google Gemini 1.5 Flash (with multi-version fallback) to generate natural, comforting, and personalized responses.
  • Intelligent Sentiment Analysis: Automatically detects user emotions—such as joy, sadness, anger, stress, or boredom—to tailor the tone and personality of the conversation.
  • Contextual Awareness: Maintains a conversational memory (up to 6 rounds of dialogue) to ensure continuity and depth in long-term interactions.
  • Comprehensive Admin Dashboard: A full-featured management portal for monitoring conversation metrics, user engagement statistics, and sentiment distribution.
  • Robust Error Handling: Implements graceful degradation with keyword-matching fallbacks to ensure availability even during LLM service interruptions.

🛠️ Technical Architecture

Tech Stack

  • Framework: Next.js with TypeScript for a robust full-stack foundation.
  • Messaging Interface: Line Messaging API for seamless mobile integration.
  • Storage: MongoDB Atlas with Mongoose ODM for scalable conversation logging.
  • AI/ML: Google Gemini API for natural language understanding and generation.
  • Validation: Zod for strict schema validation across API boundaries.

System Workflow

  1. Reception: User message is received via the Line Webhook.
  2. Analysis: The message is processed by the sentiment engine to identify the user's emotional state.
  3. Synthesis: The LLM generates a response using a dynamic prompt that incorporates the detected emotion and recent conversation history.
  4. Delivery: The synthesized response is sent back through the Line Bot SDK while the transaction is logged for analytical purposes.

📊 Management & Monitoring

The integrated dashboard provides real-time insights into:

  • Total conversation volume and message frequency.
  • Heatmaps of user sentiment trends.
  • Detailed message logs for quality assurance and system tuning.

This project was developed as part of the Web Services course (HW6) at National Taiwan University.

Share...

Enjoyed this read?

Comments

Share your thoughts and feedback.

0 total