Setting Slots from Dropdown in RASA

I need assistance with setting slots from dropdown options in RASA. Currently I’m using the dropdown from this Chatbot Widget https://github.com/JiteshGaikwad/Chatbot-Widget/blob/main/docs/responses.md#dropdown

However when i select the options from the webchat the slot is always set to None.

I have created slot in domain.yml,

slots:
  game_name:
    type: any

entities:
- game_name

and also created an intent

- intent: game_option
  examples: |
    - [Access Platc](game_name)
    - [Citk Platc](game_name)
    - [Diamond Platc](game_name)

and in stories.yml, I set this:

- intent: game_option
  - slot_was_set:
      - game_name

I dont understand why it’s still returning None

Try to set autofill:

config:
  store_entities_as_slots: true

slots:
  game_name:
    type: any
    auto_fill: true

If it doesn’t work, please share the code for the response.

@ChrisRahme I just tried it now, its not working. The response is from a custom action as below:

class ActionListGames(Action):
    def name(self) -> Text:
        return "action_list_games"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        response_games = requests.get("https://www.gamexn.com/api/v2/games")
        processed_output = json.load(io.BytesIO(response_games.content))['data']['games']

        games = [
            {
                "label": row['gameName'],
                "value": "/game_option{\"game_name\": \"" + row['gameCode'] + "\"}"
            } for row in processed_output
        ]
        message = {"payload": "dropDown", "data": games}

        dispatcher.utter_message(text="Please select a game option:", json_message=message)
        return []

There is an extra closing bracket at the end there :slight_smile: Hopefully this is the culprit!

@ChrisRahme Not really, I made that mistake while copying the code. Without the second bracket it still doesnt work.

Oh well… I reviewed your code multiple times and it seems fine.

Try raising an issue in the repo.

oh ok. I will do just that. I have been wondering too. Thanks

1 Like