Hello everyone,
I’m having a little bit of trouble with the SlotSet()-function.
First of all: the slot in the domain looks like this:
language:
type: any
auto_fill: false
(I broke it down to the bare minimum, it used to be a categorical slot)
So my project has a action_welcome and it first checks which language to use:
language = self.select_language(tracker, texts, tracker.latest_message["text"])
the select_language function returns
the predefinded default-language-code “DE” , if the slot has not been set before (aka when the bot is started for the first time) or a new language-code according to the latest message the user sent (i.e. latest user message is “english” → select_language returns “EN” or else it simply returns the language the tracker has currently stored
At the end of my custom action I want to set the language slot, by doing:
return [SlotSet("language", language)]
if the slot value was none before (on start-up) this works just fine,
but when I want to change between languages it doesn’t store the new language code, even though the language variable is correct.
It may be important to mention, that action_welcome often is a FollowupAction to another action called action_out_of_scope. action_out_of_scope handles almost every user input, it also initially checks, if the user wants to change the language and if so it returns [FollowupAction(“action_welcome”)].
So here is little example run down (without the bots answers, italic text are the print statements from the action sever):
user: hallo
tracker language at beginning of action welcome: none
language variable shortly before it schould be set: DEuser: wie war dein Tag
tracker language in out of scope: DE (so it was set correctly, when it was none before)user: english
tracker language at beginning of action welcome: DE
language variable shortly before it schould be set: ENuser: how was your day
tracker language in out of scope: DE (didn’t change to EN)
I honestly do not know, where I am doing something wrong, any help on this would be highly appreciated.