-
Notifications
You must be signed in to change notification settings - Fork 42
fallback
morfeusys edited this page Mar 31, 2020
·
4 revisions
Each time the user sends a request that can't be handled by any state of the scenario, a fallback state will be activated without a changing the current dialogue's context.
init {
state("state1") {
activators {...}
action {...}
}
fallback {
reactions.say("Sorry, I didn't get that. Could you repeat please?")
}
}Fallback builder utilises a CatchAll activator.
Thus you have to add it to the list of activators of the BotEngine:
val helloWorldBot = BotEngine(
model = HelloWorldScenario.model,
activators = arrayOf(
...,
CatchAllActivator
)
)Fallback state doesn't change the current dialogue's context meaning that the next user's request will be processed in the same context as a previous one.
It's possible to use fallback as an inner state:
init {
state("state1") {
activators {...}
action {...}
fallback {
reactions.say("Okay!")
}
}
fallback {
reactions.say("Sorry, I didn't get that. Could you repeat please?")
}
}