I’m setting a slot value called ‘Emotions’ from a value I’m pulling from a JSON server. This value is changing and can be the value of ‘Happy’, ‘Neutral’ and ‘Sad’. I’m feeling the slot depending on what I get back from the JSON server. I’m having a problem with my stories since it doesn’t follow it. Im first treating the bot, which will then go and run the custom action to fill this slot called emotion, and based on what value is put into the slot the conversation would proceed differently. Currently, its picking up what slot values are been filled but it doesn’t follow the stories, for example the slot value could be ‘Sad’ but will follow the happy path. Any help would be great
##Actions.py### class ActionEmotionSubmit(Action):
def name(self) -> Text:
return "action_submit_emotion"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
r = requests.get('http://localhost:3000/emotion')
jsonData = r.json()
emotion = jsonData[0]['currentEmotion']
return [SlotSet("emotion", emotion)]
##Stories
-
story: interactive_story_2 steps:
- intent: greet
- action: action_submit_emotion
- slot_was_set:
- emotion: Happy
- action: utter_greet_happy
- intent: my_name
entities:
- name: latif
- slot_was_set:
- name: latif
- action: utter_reply_name_happy
-
story: interactive_story_1 steps:
- intent: greet
- action: action_submit_emotion
- slot_was_set:
- emotion: Neutral
- action: utter_greet_neutral
- intent: my_name
entities:
- name: latif
- slot_was_set:
- name: latif
- action: utter_reply_name_neutral
-
story: interactive_story_3 steps:
- intent: greet
- action: action_submit_emotion
- slot_was_set:
- emotion: Sad
- action: utter_greet_sad
- intent: my_name
entities:
- name: latif
- slot_was_set:
- name: latif
- action: utter_reply_name_sad
##Domain version: ‘2.0’ session_config: session_expiration_time: 60 carry_over_slots_to_new_session: true intents:
- my_name
- greet
- mood_happy
- affirm
- goodbye
- deny
- mood_unhappy
- bot_challenge
- day_info_celebrations entities:
- emotion
- name
slots:
name:
type: text
influence_conversation: true
emotion:
type: text
influence_conversation: true
requested_slot:
type: text
influence_conversation: false
responses:
utter_greet_neutral:
- text: Hey there! May i have your name? utter_greet_happy:
- text: Hey there smiley! that smile looks great on you. May i have your name? utter_greet_sad:
- text: Hey, cheer up there! i bet a smile would lookg good on you. May i have your name please? utter_reply_name_neutral:
- text: Thank you {name}, i’m Lolly your emotional AI chatbot. How are you today? utter_reply_name_happy:
- text: Thank you {name}, i’m Lolly your emotional AI chatbot. No need to ask how you are doing i can tell your happy today! utter_reply_name_sad:
- text: Thank you {name}, i’m Lolly your emotional AI chatbot. I can see that your sad. utter_cheer_up:
- text: ‘Here is something to cheer you up:’ image: https://i.imgur.com/nGF1K8f.jpg utter_did_that_help:
- text: Did that help you? utter_happy:
- text: Great, tell me about your day! utter_unhappy:
- text: I understand, everyone has these types of days. If you dont mind, tell me about your day! utter_goodbye:
- text: Bye utter_iamabot:
- text: I am a bot, powered by Rasa. utter_day_response_happy:
- text: Thats great to hear, It seems like you had fun at the {celebration} actions:
- action_submit_emotion
- action_submit_name
- utter_greet_happy
- utter_greet_neutral
- utter_greet_sad
- utter_reply_name_happy
- utter_reply_name_neutral
- utter_reply_name_sad
forms:
name_form:
name:
- type: from_entity entity: name