Rasa doesn't save slots

Hello, I’m new to Rasa and I have a problem with the slots and a custom action. I use Rasa 2.0 Open Source and Rasa X. I want to create a chatbot that creates a file using a Linux command. It’s in German. The user writes “Datei erstellen” (create file) and has to write after that the filename and filetype (these are the two slots, the filetype can be choosen by buttons). After that the Chatbot should call the actions.py where he creates the file (e.g. touch test.txt).

The problem is that the bot goes to action.listen() instead of calling my action “action_create_file”. I corrected it in Rasa X but there are no slots saved. For debugging reasons I have only printed down the slots without executing a touch command. The two slots are None.

domain.yml:

Blockquote session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true
intents:
- create_file
- entry_filetype
- entry_filename
- greet
- goodbye
- affirm
- deny
- whoami
- bot_challenge
- entry_filetype{"filetype":"txt"}
- entry_filename{"filename":"Kontakte"}
entities:
- filename
- filetype
- is_directory
slots:
  filename:
    type: text
    auto_fill: false
    influence_conversation: true
  filetype:
    type: text
    auto_fill: false
    influence_conversation: true
  is_directory:
    type: bool
    influence_conversation: true
responses:
  utter_greet:
  - text: Hallo :)
  utter_goodbye:
  - text: Auf Wiedersehen :)
  utter_whoami:
  - text: Ich bin Kevin, ein Chatbot der FI-TS.
  utter_ask_filename:
  - text: Ich brauche noch den Dateinamen um die Datei zu erstellen.
  utter_ask_filetype:
  - buttons:
    - payload: /entry_filetype{{"filetype":"txt"}}
      title: Textdatei (.txt)
    - payload: /entry_filetype{{"filetype":"html"}}
      title: HTML Datei (.html)
    text: Ich brauche noch den Dateityp um die Datei zu erstellen.
actions:
- action_create_file
- utter_ask_filename
- utter_ask_filetype
- utter_greet
version: '2.0'

stories.yml:

version: “2.0”

stories:

  • story: greeting

    steps:

    • intent: greet

    • action: utter_greet

  • story: Create file story

    steps:

    • intent: create_file

    • action: utter_ask_filename

    • intent: entry_filename

    • action: utter_ask_filetype

    • intent: entry_filetype

    • action: action_create_file

  • story: Test Story Create file

    steps:

    • intent: create_file

    • action: utter_ask_filename

    • intent: entry_filename

      entities:

      • filename: “Kontakte”
    • slot_was_set:

      • filename: “Kontakte”
    • action: utter_ask_filetype

    • intent: entry_filetype

      entities:

      • filetype: “txt”
    • slot_was_set:

      • filetype: “txt”
    • action: action_create_file

  • story: interactive_story_1

    steps:

    • intent: create_file

    • action: utter_ask_filename

    • intent: entry_filename

      entities:

      • filename: Kontakte
    • action: utter_ask_filetype

    • intent: entry_filetype

      entities:

      • filetype: txt
    • action: action_create_file

    • slot_was_set:

      • filename: null
    • slot_was_set:

      • filetype: null

nlu.yml:

actions.py:

from typing import Any, Text, Dict, List

from rasa_sdk import Action, Tracker

from rasa_sdk.executor import CollectingDispatcher

from rasa_sdk.events import SlotSet

import os

import subprocess

DATEI ERSTELLEN

class ActionCreateFile(Action):

def name(self) -> Text:

    return "action_create_file"

def run(self, dispatcher: CollectingDispatcher,

        tracker: Tracker,

        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

    #os.system('touch hello.txt')

    

    fname = tracker.get_slot('filename')

    ftype = tracker.get_slot('filetype')

    print(fname)

    print(ftype)

    #dispatcher.utter_message(text="Hello.txt wurde erstellt :)")

    message = "Datei {} {} wurde erstellt".format(fname, ftype)

    dispatcher.utter_message(text=message)

    #  Konsolenausgabe in Rasa Shell ausgeben

    #output = subprocess.check_output("date", shell=True)

    #dispatcher.utter_message(text=str(output))

    return [SlotSet("filename", fname), SlotSet("filetype", ftype)]

    # return []

Again: The last action (action_create_file) is only called because I corrected it. Usually he just says action_listen. And the slots are both “None”. So the created file is “None None” instead of "Kontakte txt). How can I fix this?

I think your problem might be the last entries in the intents section. It looks like you’re setting them with the buttons but not setting the intents “entry_filetype” and “entry_filename”, which are what you really want to be doing. The /intent{entity} syntax is only necessary in the definition of the actual buttons under responses. I thiiiink your problem may be resolved if you just delete those last two lines.

@rctatman Thank you. Now the bot asks the filetype instead of listening, but the slots are still “None”. Here is the story (I use Rasa X “Talk to your bot” for testing).

version: “2.0” stories:

  • story: Story from Conversation ID 989643b3272149269c4aded6111ff27c steps:
    • intent: create_file
    • action: utter_ask_filename
    • intent: entry_filename entities:
      • filename: Kontakte
    • action: utter_ask_filetype
    • intent: entry_filetype entities:
      • filetype: html
    • action: action_create_file
    • slot_was_set:
      • filename: null
    • slot_was_set:
      • filetype: null

Mmm, hard to say what’s going on without more info. Do you have your Rasa & Action server logs?

Where can I find them? If you mean the console log where I start rasa x, there are no errors.