Hi I'm trying to set some message to be uttered when the user restart the conversation. I have asked in Rasa Forum and tried to change the code. But it returned this error
AttributeError: ‘Tracker’ object has no attribute ‘utter_message’
This is the code that I wrote:
class ActionRestarted(Action):
""" This is for restarting the chat"""
def name(self) -> Text:
return "action_restart"
async def run(
self,
tracker: Tracker,
dispatcher: CollectingDispatcher,
domain: Dict[Text, Any],) -> List[Event]:
from rasa.core.events import Restarted
# only utter the template if it is available
evts = await super().run(tracker, domain, dispatcher.utter_message("Restarted"))
return evts + [Restarted()]
Feel free to point out my mistake and correct them thank you
You are trying to pass the return value of
utter_message
as thedispatcher
parameter ofsuper.run()
, where it expects aCollectingDispatcher
object.You can just call
utter_message
from yourrun
method.