Effect that drops a specified input from an action.
The FindRecipes
action attempts to find recipes fulfilling a number of user inputs. However, in some cases there might be no results satisfying all these inputs at once. Instead of going to the NoResults
state, you can use drop
effects to loosen and repeat the search.
This example checks for the presence of several different constraints and repeats the search without them. Wrapping them inside an ordered-effects
block allows multiple inputs to be dropped at once. By grouping drop
effects together like this, it reduces the number of relaxation passes and allows Bixby to get results faster.
output (Recipe) {
on-empty {
if (exists(servings)) {
drop (servings)
} else-if (exists(course) || exists(meal) || exists(cuisine)) {
ordered-effects {
drop (course)
drop (meal)
drop (cuisine)
}
}
}
}
When implementing an action in the JavaScript layer, you might want to explicitly
ask the action modeling layer to drop an input. This way the input is also
removed from context and this is reflected in the dialog. To do so,
decide on a CheckedError
code to throw and catch.
In this example, the action was looking for a geocoded address and requested for the postal code to be dropped:
error (DROP_POSTAL_CODE) {
on-catch {
drop(postalCode)
}
}
Copyright 2024 Samsung All rights reserved