question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slot is not resetting even after the submit action

See original GitHub issue

Rasa version: rasa-core==0.13.7 and rasa-core==0.14.1 Python version: Python 3.6.7

Operating system (windows, osx, …): Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic

Issue: Slot is not resetting even after the submit action, when using FormAction

Steps to reproduce the issue:

  • Add a new FormAction for a single slot
  • Try to ask a question without the slot value present in the user input. The utter_ask action performs and the slot filling questions is asked correctly.
  • Try to ask the same question again.

Expected result:

  • It should perform the utter_ask action for asking the slot value again, since the slot value is not present in the user input.

Actual result:

  • It does not perform the utter_ask action for the missing slot. It uses the slot value, which was set for the previous scenario. This is wrong.

Please note that the slot is resetting correctly, if the user asks some other questions in between and then come back and ask the slot related question again. Please see the sample scenario below to understand the issue correctly.

Sample scenario:- User:> Could you please send me the sever url? Bot:> Please confirm the environment? (Dev or Stg) User:> dev Bot:> The user has asked ‘dev’ environment

User:> hello User:> Hello, how can I help?

User:> Could you please send me the sever url? Bot:> Please confirm the environment? (Dev or Stg) User:> dev Bot:> The user has asked ‘dev’ environment

User:> Could you please send me the sever url? Bot:> The user has asked ‘dev’ environment

Content of configuration file (config.yml):

language: "en"

pipeline:
- name: "nlp_spacy"                   # loads the spacy language model
- name: "tokenizer_spacy"             # splits the sentence into tokens
- name: "ner_crf"                   # uses the pretrained spacy NER model
- name: "intent_featurizer_spacy"     # transform the sentence into a vector representation
- name: "intent_classifier_sklearn"   # uses the vector representation to classify using SVM
- name: "ner_synonyms"                # trains the synonyms

Content of domain file (domain.yml) (if used & relevant):

forms:
- action_server_url
entities:
- environment
slots:
  environment:
    type: unfeaturized
    auto_fill: false

Content of stories file (stories.md):

## server url happy path
* request_server_url{"url": "url", "server": "server", "dev": "environment"}
    - action_server_url
    - form{"name": "action_server_url"}
    - form{"name": null}

Content of actions.py file (actions.py):

class ServerUrlRequestForm(FormAction):
    def name(self) -> Text:
        return "action_server_url"

    @staticmethod
    def required_slots(tracker: Tracker) -> List[Text]:
        return ["environment"]

    def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
        return {
            "environment": [self.from_text()],
        }

    def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
        return {
            "environment": [self.from_entity(entity="environment", intent='inform')]
        }

    def submit(
        self,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
    ) -> List[Dict]:
        environment = tracker.get_slot('environment')
        dispatcher.utter_message("The user has asked '{}' environment" . format(environment))
        return []

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
anoop2503commented, May 8, 2019

Thank you @Ghostvv for sharing your suggestion. That make sense. It works as expected, if we reset the slot manually in submit action. Hence, closing this ticket.

0reactions
Ghostvvcommented, May 8, 2019

do we need to keep those value even after the submit action - it is very much dependent on a use case, therefore reseting slots should be done manually in your custom submit method.

the same impact as resetting the slot automatically. - impact is the same

the bot behavior depends on what you want to achieve, if you want to ask the question again return [SlotSet(slot_name, None)] in your submit method

Read more comments on GitHub >

github_iconTop Results From Across the Web

Slots are not resetting after custom action is met
I've created a custom action which is triggered with the default fallback intent and resets the slots and restarts the flow. However, it...
Read more >
Slots not resetting - Rasa Open Source
I'm modifying the wellness bot and am having trouble resetting the slot values. I want to reset the slot values after all of...
Read more >
Appointment field time slot is not reset even submission ...
How to reset this field after my test... Deleting subscriptions in the backoffice is not the solution...Thanks.
Read more >
Solved: New Item Form resets before submitting
I've created a screen with an Edit form in it which will be used to submit a new item to a SharePoint List....
Read more >
<input type="reset"> - HTML: HyperText Markup Language
elements of type reset are rendered as buttons, with a default click event handler that resets all inputs in the form to their...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found