I am trying to use a DialogueStateTracker, that would allow me to export the current story to a file. This is my custom Action:
class ActionTagFeedback(Action):
"""Tag a conversation in Rasa X as positive or negative feedback, save the positive Story. Negative Stories should be reviewed. """
def name(self):
return "action_tag_feedback"
def run(self, dispatcher, tracker, domain) -> List[EventType]:
feedback = tracker.get_slot("sentiment")
if feedback == "pos":
label = '[{"value":"postive feedback","color":"76af3d"}]'
DST = DialogueStateTracker(tracker.events, tracker.slots)
DST.export_stories_to_file(export_path="data/stories.md")
elif feedback == "neg":
label = '[{"value":"negative feedback","color":"ff0000"}]'
else:
return []
tag_convo(tracker, label)
return []
This is the error I am getting:
Exception occurred while handling uri: 'http://localhost:5055/webhook'
Traceback (most recent call last):
File "c:\users\januwefeldmann\anaconda3\envs\rasa\lib\site-packages\sanic\app.py", line 976, in handle_request
response = await response
File "c:\users\januwefeldmann\anaconda3\envs\rasa\lib\site-packages\rasa_sdk\endpoint.py", line 102, in webhook
result = await executor.run(action_call)
File "c:\users\januwefeldmann\anaconda3\envs\rasa\lib\site-packages\rasa_sdk\executor.py", line 387, in run
events = action(dispatcher, tracker, domain)
File "C:\Users\JanUweFeldmann\Documents\ChatbotNotebooks\actions.py", line 197, in run
DST = DialogueStateTracker(tracker.events, tracker.slots)
File "c:\users\januwefeldmann\anaconda3\envs\rasa\lib\site-packages\rasa\core\trackers.py", line 135, in __init__
self.slots = {slot.name: copy.deepcopy(slot) for slot in slots}
File "c:\users\januwefeldmann\anaconda3\envs\rasa\lib\site-packages\rasa\core\trackers.py", line 135, in <dictcomp>
self.slots = {slot.name: copy.deepcopy(slot) for slot in slots}
AttributeError: 'str' object has no attribute 'name'
I assume the format of tracker.slots doesn’t quite fit the DialogueStateTracker, but I am not sure if this is how I am supposed to initialize the DST at all. Can anyone point me in the right direction? I would be very grateful.