International Engineering Publisher
Serving Researchers Since 2012

Smart Emotional Chatbot

DOI : https://doi.org/10.5281/zenodo.18163330
Download Full-Text PDF Cite this Publication

Text Only Version

 

Smart Emotional Chatbot

Vrishab M

CSE Department, Ballari Institute of Technology & Management, Ballari, India

Vishnu Joshi

CSE Department, Ballari Institute of Technology & Management, Ballari, India

Mrs. Pratibha Mishra

CSE Department, Ballari Institute of Technology & Management, Ballari, India

Yuvaraj M

CSE Department, Ballari Institute of Technology & Management, Ballari, India

Vaishnavi Joshi

CSE Department, Ballari Institute of Technology & Management, Ballari, India

ABSTRACT : This project presents the development of a mental health support chatbot that leverages large language models (LLMs) and domain-specific knowledge to provide reliable, empathetic responses. The system integrates Groqs high- performance LPU-powered LLMs with a retrieval-augmented generation (RAG) pipeline, enabling the chatbot to access curated mental health literature stored in a Chroma vector database. Documents such as Defining Mental Health and Mental Illness are pre-processed using text splitting and integrated with Hugging Face models to ensure efficient semantic search. When users enter a query, the retriever identifies relevant situations or cases, which are then combined with the users question and passed to the LLM through a structured prompt. The chatbot is deployed on a Gradio interface, providing an understandable conversational platform that supports for example queries and personalized interaction. Crucially, the system prioritizes user safety by incorporating a proactive alert mechanism. If distress patterns are detected, the system automatically sends an email notification to a pre- registered trusted contact. The knowledge base emphasizes key mental health topics including the definitions of mental health and illness, the scale of adolescent mental health problems, the impact of stigma, and evidence-based interventions. By combining the strengths of LLMs with domain-related documents, this system aims to enhance mental health literacy, reduce misinformation, and provide accessible, Honorable, and meaningful free guidance.

Keywords : Mental support chatbot, emotional chatbot, semantic Search, Mental Health Literacy

  1. INTRODUCTION

    Mental health has become one of the biggest concerns of our time, yet many people still struggle to get the help they need and therapy can be expensive, mental health professionals are often scarce, and many people avoid seeking help because of fear or social stigma. Consequently, millions suffer silently with ugly outbreaks and no aid in sight at the time of their greatest need. This is a clear example of why support systems need to be easily accessible, always with not one bit of judgment attached in any way.

    To mitigate the shortage in this field, an AI-based companion service named Smart Emotional Chatbot was created as a supportive tool that could provide emotional support at any time of day. Unlike regular old chatbots, it blends in Llama-3s empathetic language skills and an RAG system that draws from trusted mental health information sources. The chatbot doesnt act based on random.

    1. OBJECTIVES
      1. To generate human-like emotional understanding and supporting users emotionally.
      2. To integrate GPT-based natural language generation for creating empathetic and relevant responses.
      3. To evaluate the effectiveness and emotional accuracy of the chatbot in providing comfort, encouragement or validation in various conversational scenarios.
    2. EXISTING SYSTEM

      Current mental health chatbots mostly provide static, rule- based, or scripted responses, offering limited personalization. Many of them depend on fixed FAQs or very basic conversation systems that cant pull in information from real research or updated sources. Because of this, users usually end up getting very general advice instead of personalized, accurate guidance based on real facts. Many existing systems also face issues with scaling, maintaining accuracy, and earning user trust, mainly because they are not supported by a strong retrieval system that connects LLMs with well-organized vector databases.

    3. PROPOSED SYSTEM

      The Smart Emotional Chatbot is designed to act like a caring and intelligent companion that helps bridge the gap between everyday AI chat tools and real mental health support. Unlike regular chatbots that give basic robotic replies, this system is built with emotional intelligence at its core. It uses advanced natural language processing to create a safe and private space

      where users can talk about their feelings, deal with stress, and access reliable mental-wellness guidance. One of the most important features of this chatbot is its Crisis Intervention Module. While it usually behaves like a friendly listener, it also keeps an eye out for words or phrases that might show the user is in serious emotional distress or thinking about self-harm. If it detects anything alarming, the chatbot immediately shifts from being supportive to take action. It sends an automatic alert to the users chosen Trusted Contact letting someone in their real life know that help may be needed right away. By combining secure login, empathetic conversations, and timely emergency support, the Smart Emotional Chatbot becomes more than just a talking system it can act as a lifeline. It ensures that users are not alone and can get help exactly when they need it the most.

    4. SYSTEM FEATURES
      1. The chatbot uses Llama-3 to understand natural conversations and respond with empathy based on the users emotions.
      2. It must accurately identify the user’s emotional state, such as joy, sadness, or anger, to tailor responses appropriately Target Users.
      3. It can detect distressing keywords in real time and immediately shift into safety mode by showing emergency helpline information.
      4. If the user is in crisis, the system sends an urgent email alert to their trusted contact so real-world help can reach them quickly.
      5. The chatbot should be able to understand messages written in normal, everyday language so users can interact with it naturally and easily.
      6. The chatbot provides accurate, evidence-based guidance by pulling information from verified mental-health documents using the RAG method.
      7. User accounts are protected through secure login and password encryption, with options to update country and emergency contact details.
  2. LITERATURE SURVEY

    Several researchers have explored the integration of artificial intelligence and emotional intelligence in chatbots to provide effective mental health support. Rawat et al. [1] proposed an emotional chatbot using a hybrid LSTM and GPT- based model for emotion classification and response generation, achieving an accuracy of 90.27%. Sadulloyeva et al. [2] developed an AI-driven chatbot focused on addressing pandemic-related emotional distress, with a classification accuracy of 98.75% for detecting mental disorders. Banjar et al.

    [3] introduced Motus Up, a mobile application combining EEG-based emotion recognition with a rule-based chatbot to help users manage negative emotions. Antony et al. [5]conducted a survey on emotion recognition-based mental healthcare chatbots, outlining a four-phase framework for building emotionally intelligent conversational systems. Devaram [6] discussed the concept of empathic chatbots that

    incorporate emotional intelligence to promote mental well- being, emphasizing both their advantages and limitations. Rashkin et al. [7] developed empathetic open-domain conversational models and established new benchmarks and datasets for evaluating emotional dialogue systems. Zhou et al.

    1. presented the Emotional Chatting Machine, a neural model using internal and external memory to generate emotion- aware conversations. Hsu et al. [9] created Emotion Lines, a corpus of multi-party conversations annotated with emotions, contributing valuable training data for emotional dialogue systems. Ghosh et al. [10] proposed Affect LM, a neural language model designed for affective text generation that enables customizable emotional expression. Collectively, these works highlight significant progress in emotion recognition and empathetic response generation, forming a strong foundation for developing the Smart Emotional Chatbot, which integrates Large Language Models (LLMs) with real-time emotion understanding to provide empathetic and contextually relevant mental health support.
  3. METHODOLOGY

    The Smart Emotional Chatbot is built using a thoughtful and balanced methodology that combines the emotional sensitivity of AI with the accuracy needed for mental-health support. Instead of letting the AI reply only from what it has learned during training, the system uses a method called Retrieval- Augmented Generation (RAG). This means the chatbot looks up information from real, verified mental-health documents before giving an answer. To enable this, the system ingests trusted mental-health PDFs and splits them into smaller, meaningful fragments. These pieces are then encoded into number vectors with the HuggingFace models and persisted within a ChromaDB database.

    So, when a user types in a question, the chatbot combs this database for what it rates as the most relevant and reliable information. This data is concatenated with the users message and is submitted as an input to the Llama-3 model using the Groq API. As such, the chatbots responses are human in tone and understanding but also grounded by real medical knowledge cutting down on likelihood of incorrect or dangerous replies. The highest emphasis is given to safety. Thats why the system also includes a strong security layer that works alongside the AI. First, users log in through a secure authentication system that protects passwords using SHA-256 encryption. Once logged in, every message a user sends, is immediately checked by a special Crisis Detection Algorithm. This tool scans for dangerous keywords like self-harm or suicide even before the AI tries to respond. If any of these words are said, the chatbot goes into emergency mode immediately. It interrupts a regular conversation, displays key helpline numbers depending on users location and sends an automated mail to users selected Trusted Contact via Pythons SMTP service. This simply makes sure that someone in the real world knows about you and can help immediately.

    All of this for ensuring login security, conversation handling, crisis detection, fetching verified information and giving responses neatly integrated through a lightweight gradio interface. The chat-window makes everything simple for the

    user, while behind the scenes the system is ensuring they stay safe, supported and informed. Collectively, these ingredients form a chatbot that is supportive as well as trustworthy. The mix of emotional intelligence, vetted information and robust safety features allow users to speak candidly without fear of judgement or misinformation. Users can also ask the system for help, and it will adjust to users various emotional states, offering comfort as needed while also giving precise guidance. HAVIT Smart Emotional Chatbot combines technology with compassion to provide women around the world a place where they can speak freely, feel heard, and get timely support whilst on the move, it is practical caring companion for anyone in need of emotional or mental-wellness help.

    The complete working model / Flowchart is shown in figure 2 and its use-case diagram is presented in figure 1.

    Fig 3. Sequence Diagram

    Fig 1. Use Case Diagram

    Fig 4. Context Diagram

  4. RESULTS AND DISCUSSIONS

    Fig 2. Flowchart

    The Smart Emotional Chatbot understands a user’s emotion and provides empathetic, contextually appropriate responses via advanced LLM & RAG integration. Testing demonstrated far better emotional accuracy, response relevance, and user satisfaction than traditional chatbots. And here is a more human-like, longer and simpler sentence. The system helps bridge the divide between how AI communicates and how humans express emotions. It adds an extra layer of realism to conversations and creates a warmer and more engaging dialogue as It enables users to engage with the chatbot in a manner that is nearly comparable to having a conversation with

    another person. Given that the system can offer trustworthy, research-based mental health recommendations, it has high potential to enhance emotional well-being and make people feel more confident and comfortable in talking with AI.

    1. OUTPUTS

      Fig 7. Response to emergency situations

      Fig 3. Login page [authentication]

      Fig 4. Account creation in Smart Emotional Chatbot

      Fig 5. Trusted person details for emergency control

      Fig 6. Response to the message

      Fig 8. Emergency report to a trusted person (secret message)

  5. CONCLUSION

    The Smart Emotional Chatbot Project proves that AI does not need to be just a chat tool it has the potential to serve as an early support mechanism for those with mental health issues. It provides warm, human-like conversation as well as keeping users always protected. Unlike previous chatbots, which only stick to hard and fast rules, this system can understand the

    users predicament, remember the context of earlier conversations about that situation and respond with what appears to be real sympathy. Meanwhile, its emergency alert capability provides an extra layer of protection by ensuring any sign of serious trouble is reported back to a trusted person in the real world. This means that no one needs to feel isolated in an untenable situation.

    Finally, the Smart Emotional Chatbot is a practical and secure safe character that could be widely used as support system for matching IBM clinical treatment with the everyday emotional needs of maintaining mental health. It is a promising early attempt to utilize AI in a safe and meaningful manner for positive impact on mental wellness.

  6. REFERENCES
  1. Rawat, D., Sangeetha, K., & Khan, S. (2025). Emotional Chatbot: AI for Mental Health Support. This study presents a hybrid chatbot using LSTM and GPT for emotion classification and response generation, achieving 90.27% accuracy.
  2. Sadulloyeva, I., Raufov, F., Bakhadirova, M., Nasirova, N., Pekhanova, Y., Mamarasulova, I., Pulatova, B., & Khakimova, M. (2024). Development of a Chatbot for Mental Health Support Using AI- Intelligent. Achieving 98.75% accuracy in mental disorder classification.
  3. Banjar, H. R., Alsefri, L., Alshomrani, A., Hamdhy, M., Alahmari, S., & Sharaf, S. (2024). Activating the Mobile User Interface With a Rule- Based Chatbot and EEG Based Emotion Recognition to Aid in Coping With Negative Emotions.
  4. Antony, C., Pariyath, B., Safar, S., Sahil, A., & Nair, A. R. (2020). Emotion Recognition-Based Mental Healthcare Chat-bots:A Survey. Surveys methods in emotion recognition chatbots, proposing a four-phase framework and discussing applications in low-resource settings.
  5. Devaram, S. (2020). Empathic Chatbot: Emotional Intelligence for Mental Health Well-being. The paper discusses emotion recognition in mental support, noting both benefits and limitations.
  6. Rashkin, H., Smith, E. M., Li, M., & Boureau, Y. L. (2019). Towards Empathetic Open-domain Conversation Models: A New Benchmark and Dataset. Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics (ACL 2019). https://doi.org/10.18653/v1/P19- 1359
  7. Zhou, H., Huang, M., Zhang, T., Zhu, X., & Liu, B. (2018). Emotional Chatting Machine: Emotional Conversation Generation with Internal and External Memory. AAAI Conference on Artificial https://doi.org/10.1609/aaai.v32i1.11247
  8. Hsu, W.-N., Lin, C.-K., Xu, P., Glass, J., & Lee, H.-Y. (2018). Emotion

    Lines: An Emotion Corpus of Multi-Party Conversations. Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018). https://aclanthology.org/L18-1181

  9. Ghosh, S., Chollet, M., Laksana, E., Morency, L.-P., & Scherer, S. (2017). Affect LM: A Neural Language Model for Customizable Affective Text Generation. Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (ACL 2017). https://doi.org/10.18653/v1/P17-1175