Bot die when cannot understand user

Hi everyone, i have some issue when develop my chatbot to order lunch in form action, i have 3 variables : lunch_num_slot, date, location. when bot ask the user: “which location do you want”. if user answer a chitchat like: “adsfasd//ss@%#&”. My bot wil be die and user cannot restart the bot. Can you help me

thanks

the bot die. i mean. the bot cannot receive, understand any text i chat to it

error: Encountered an exception while running action ‘order_lunch_time_form’. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.

Hello @vunt39,

Do you see any error log in the action server command line ? If yes can you post the log here ?

hello huy, in the command line . The error log is :

error: Encountered an exception while running action ‘order_lunch_time_form’. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information

i dont understand why user chat some think like : “asdfa@$#@!32”. Bot is die and cannot understand any input from user. Can you help me

I meant the action server log which rasa tell you to check. Did you run the action server before testing the bot ?

To ensure the bot logic flows in its planned path, you will need to declare some possible pausing of form, ending of forms or even ignoring forms in the middle of a convo. Don’t make a single story too long

You need to have more cases in your stories that’s what I would guess.

May I know how many cases are there for your form stories and other trivial convos?

oh. Action server have no attention. And of course i run the action server before testing the bot Huy bui. Can you send me your email address . i can ask you in vietnamese to solve more issue. i’m newbie in rasa chatbot

i think my story is not too long. it only have 4-5 step to end the stories

So there is no error log from the action server cmd line, that’s weird. Normally when you encountered an Exception, there will be information about it in the action server cmd line and we can debug from that.

Well, normally when the bot can’t understand what the user’s intent is or not able to pick up entity in a form, it will execute FallbackAction, which utter something like: “Sorry, i don’t understand what you are saying” and then revert back to the latest intent.

But you need to declare the FallbackPolicy in config.yml in order for the bot to behave like that. Did you declare your FallbackPolicy ? If not, please try and see how it goes. You can read more about FallbackPolicy here: Policies

oh. thank you so much. i also have a issue in my chatbot. it’s select option in my bot. for example : bot ask: please select your option:

  • order pizza
  • order noodle
  • order pasta I want user chat: 1 to order pizza, 2 to order noodle, 3 to order pasta Can you help me about that

This can be a little bit complicated. I can suggest you a way but it’s not perfect. It depends on you to choose and implement accordingly to your usage.

First, you may create a seperate form just for the user to choose what to order like ChooseOrderForm:

User: I want to make an order
Bot: Please select your option:
  - order pizza
  - order noodle
  - order pasta
User: 1 (this part depends on how you do the entity extraction, maybe have a option entity for it ?)

In the submit function of the ChooseOrderForm, you check the value of ‘option’ slot:

  • If it’s 1: Use FollowupAction events to the OrderPizzaForm which will take care of the whole pizza ordering process:

     Bot: Please select the pizza which you want to order:
        .....
    
  • If it’s 2: Follow up to OrderNoodleForm

  • If it’s 3: Follow up to OrderPastaForm

As i said before, i don’t know if this solves your problem perfectly or not. But in my opinion, deviding the logic into different forms make it easier to redirect midway, as well as easier to implement the logic as different small parts. You can try and see if it fits your need.

Anyway, you can read about Events and FollowupAction event here: Events

thank you, thank you so much. (e cam on)

Hi huy, i wrote this code with my bad knowledge in python, is that true

class chooseOption(Action): def name(self): return “action_choose_option”

def run(self, dispatcher, tracker, domain):

    user_msg = tracker.latest_message.get('text')
    print(user_msg)

if user_msg == '1':
    response = "ok you choose pizza"

if user_msg == '2':
    response = "ok you choose noddle"
    
if user_msg == '3':
    response = "ok you choose pasta"

    dispatcher.utter_template("response", tracker)
    return []

i dont know why it dont run

If you want to print a message straight from the action, you should use dispatcher.utter_message() instead.

How exactly does it not run ? Please explain what you expect, how does it fail, and add any error log whenever you ask about a problem. A simple ‘it doesn’t run’ will make it hard for people to help.

oh i’m sorry. this is the log in server

rasa.core.processor - Encountered an exception while running action ‘action_choose_option’. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.

Hoặc anh có cách nào cho e nói chuyện trực tiếp với anh dc không ah chứ đôi khi nói bằng tiếng anh thì e cũng k biết miêu tả thế nào

really i want when user choose 1 or 2 or 3 bot can run another actions like.
Bot: please choose you option
user: 1
Bot: (run the action choose pizza, require: name of pizza, address of user)

change line 4 from

from rasa_sdk.actions import Action

to

from rasa_sdk import Action