Feature: Add Chatbot Readiness Checks and Refine Server Interaction
This pull request enhances the chatbot functionality by adding readiness checks and refining server interactions. These improvements ensure that the chatbot only becomes active when the Rasa server has successfully loaded a model, providing a more reliable user experience.
Key Changes:
-
Docker Configuration:
-
Simplified Rasa Server URL: Updated
docker-compose.yml
by removing the/webhooks/rest/webhook
endpoint from theRASA_SERVER
environment variable. This change streamlines the server URL configuration.
-
Simplified Rasa Server URL: Updated
-
App Enhancements:
-
Chatbot Readiness Check: Modified
src/app.py
to verify the Rasa server's model readiness before enabling chatbot interactions. This prevents users from interacting with an unavailable chatbot. - User Feedback: Added user feedback messages to inform them about the chatbot's availability status and provided instructions for training and loading a model if the chatbot is not ready.
-
Chatbot Readiness Check: Modified
-
Chatbot Class Improvements:
-
Added
is_model_ready()
Method: Implemented a new method in theChatbot
class withinrasa_chatbot.py
that checks the Rasa server's status. This method includes retry logic with exponential backoff to handle scenarios where the server might still be loading the model. - Enhanced Error Handling: Improved error handling and logging to provide clearer and more informative messages to users when the chatbot is unavailable.
-
Added
Summary:
This pull request improves the chatbot feature by ensuring it is only active when a model is properly loaded in the Rasa server. The changes simplify the server URL configuration, add readiness checks with user feedback, and enhance error handling. These updates result in a more dependable and user-friendly chatbot experience.