Back to Projects

ChatBT

AI-supported information and counseling system for universities

Full-stack · Real-time messaging · University assistant model

📌 Project overview

The following presents my article written for publication in a university journal, together with the development stages of the full-stack application.

AI-supported information and counseling system for universities

This report addresses in detail the development process of a project consisting of two main components: a real-time messaging system and a university assistant model. Developed by Eren Can Turan, a student at Dumlupınar University, and supervised by Dr. Evin Şahin Sadık and Dr. Şerif Ali Sadık, the project is designed in a modular structure and aims to optimize the user experience.

🧩 Main components

  • Real-time messaging system
  • University AI assistant (instant answers, routing to live support)

📊 University assistant model – workflow

User input is pre-processed and converted to a vector, then compared with the database. A similarity threshold is used to suggest similar questions. If useful, the user gets an automatic answer; otherwise they are connected to live support.

Question flow: preprocess, vector, compare, suggest, answer or live support

1) Real-time messaging system

User login/signup and test process

  • JWT (JSON Web Token) based session management; every request is validated for security.
  • Role-based authorization (e.g. user, admin) so users can only perform allowed actions.
  • Layered backend architecture for maintainability and readability.
  • All backend logic for login and sign-up verified with comprehensive test scenarios.

Database and backend infrastructure

PostgreSQL was chosen for the data layer. Prisma ORM is used for effective database operations, providing: structured models and connection, core models (User, Conversation, Message) with relations, and high performance. Type safety from Prisma minimizes errors during development.

Database and backend: Node.js, Prisma, PostgreSQL

Conversation and messaging logic

The Conversation model and related backend functions were developed. When a user messages another, the system creates a conversation record with participant ids, start time, and metadata. Each message stores which conversation it belongs to and who sent it, plus timestamp, content, and read status.

Profile management and image upload

Users can edit profile info (username, bio, phone) via secure API endpoints. Cloudinary is integrated for image uploads; the Next.js frontend allows easy profile photo upload. Cloudinary provides secure, fast storage and CDN for global access.

Realtime communication and Pusher integration

  • Instant messaging: messages are delivered immediately; Pusher’s WebSocket-based infrastructure enables this without page refresh.
  • Read receipts: read status is sent in real time to the sender.
  • Active user status: online/offline state is shared in real time with relevant users via Pusher.

Pusher integration improves the user experience and provides a faster, more efficient communication layer than traditional HTTP.

WebSockets: browser and server real-time communication

2) University AI assistant (instant-answer model)

Data preprocessing and NLTK stop words

The second module analyzes incoming questions and returns appropriate answers. The goal is to interpret natural language input and provide the best response, supporting students and reducing staff workload. NLTK is used to detect and filter stop words (e.g. "the", "a", "in"), remove punctuation, and normalize case. This preprocessing is critical for the chatbot to produce more accurate, meaningful results.

University information and consulting system chat interface

Model training: train–test split and sklearn

The dataset was split 85% training, 15% test using sklearn’s train_test_split. Model performance was evaluated with accuracy, precision, recall, and F1-score from sklearn.metrics.

TF-IDF vectorization

TF-IDF (Term Frequency–Inverse Document Frequency) was used to convert text to numerical vectors. Sentences were vectorized so the model could match more accurately. sklearn’s TfidfVectorizer was used; each sentence is represented by a feature vector used in similarity computation.

getResponse function and decision mechanism

User input is analyzed by similarity scores and handled in three bands: 70% and above → direct answer; 30–70% → show closest options; below 30% → send a message that the system cannot answer. Three similarity metrics were used with weights: TF-IDF 50%, Sequence similarity 30%, Word overlap 20%.

University AI assistant workflow

Similarity metrics

TF-IDF scores measure vector similarity between the user question and database questions (50% weight). Sequence similarity considers word order (30%). Word overlap is the ratio of common words (20%). The weighted combination gives a more robust result than a single metric.

Cosine similarity

Cosine similarity was used to measure similarity between sentence vectors from the TF-IDF matrix. It compares vector direction regardless of magnitude, so it is effective for text. sklearn’s cosine_similarity was used; values between 0 and 1 feed into the decision mechanism.

Performance and future improvements

The system achieves about 85% accuracy on the test set and performs well for similarity scores ≥70%. Challenges include Turkish morphology and different question phrasings. Future plans: integrate deep learning language models (e.g. BERT, GPT), continuous learning from user feedback, and Turkish-specific lemmatization.

Conclusion

The project aims to provide automatic answers to university students. Current results are achieved with basic NLP and machine learning. Future work will focus on smarter, broader responses and Turkish-specific solutions to improve performance.

University Assistant chat interface

📚 References

  1. Next.js Data Fetching – https://nextjs.org/docs/app/building-your-application/data-fetching
  2. Bhartiya et al., "Artificial neural network based university chatbot system," IEEE IBSSC, 2019.
  3. Ahmad et al., "UNISEL Bot: Designing Simple Chatbot System for University FAQs," IJITEE, 2020.
  4. Pi & Majid, "Components of smart chatbot academic model," 2020.
  5. Dibitonto et al., "Chatbot in a campus environment: LiSA," HCI International 2018.
  6. PostgreSQL Documentation – https://www.postgresql.org/docs/
  7. Prisma – https://www.prisma.io/docs
  8. Goyal et al., "Deep learning for natural language processing," Apress, 2018.
  9. scikit-learn Feature Extraction – https://scikit-learn.org/docs/modules/feature_extraction.html
  10. R. Rai, "Socket.IO real-time web application development," Packt, 2013.
  11. Liu & Sun, "Research of web real-time communication based on web socket," 2012.

📄 Publication

This project was developed by Eren Can Turan (Dumlupınar University). It was carried out under the supervision of Dr. Evin Şahin Sadık and Dr. Şerif Ali Sadık.