Hi, I wrote a custom action where I want the chatbot to print a specific message, but it is unfortunately not working. I already wrote a form and also validated the slots through their validate custom actions and it works fine there, but somehow not in my own custom action. I even tested it with the print() message it and it even prints it to the terminal which means my logic is right, but the chatbot does not print out the dispatcher message. Does anyone know why it is not printing?
actions.py
- dispatcher.message in validate_concentration() works totally fine
- dispatcher.message global_slot_action is not working, but still prints out “got in con” in terminal
class ValidatePhqForm(FormValidationAction):
def name(self) -> Text:
return "validate_initial_phq_form"
def validate_concentration(
self,
slot_value: Any,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
if slot_value == False:
dispatcher.utter_message(text="Awesome! Being able to concentrate well is a real asset.")
return {"concentration" : slot_value}
elif slot_value == True:
dispatcher.utter_message(text="That must be tough. Dealing with poor concentration can be frustrating.")
return {"concentration" : slot_value}
else:
return {"concentration": None }
class GlobalSlotAction(Action):
def name(self) -> Text:
return "global_slot_action"
def run(
self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> Dict[Text, Any]:
current_slot = tracker.current_slot_values().get("requested_slot")
current_intent = tracker.latest_message.get("intent").get("name")
print("current slot", current_slot)
print("current intent", current_intent)
if current_intent == "dont_understand":
if current_slot == "concentration":
dispatcher.utter_message(text="test") # chatbot not printing
dispatcher.utter_message(text="clarification concentration") # chatbot not printing
print("got in con")
if current_slot == "concentration_value":
dispatcher.utter_message(text="test")
if current_slot == "disinterest":
dispatcher.utter_message(text="test")
if current_slot == "disinterest_value":
dispatcher.utter_message(text="test")
return []
- Rasa Version : 3.6.0
- Minimum Compatible Version: 3.5.0
- Rasa SDK Version : 3.6.0
- Python Version : 3.10.9
- Operating System : Windows-10-10.0.19044-SP0