Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from typing import Text
4def action(plugin: str, name: str):
5 """A decorator for Ask Bob plugin actions (implementing the rasa_sdk.Action class).
7 Args:
8 plugin (str): The plugin name.
9 name (str): The action name.
10 """
12 def wrapper(action):
13 def name_method(self) -> Text:
14 if name.startswith("validate_"):
15 return "{}_{}".format(name, plugin)
16 else:
17 return "action_{}_{}".format(name, plugin)
19 setattr(action, "name", name_method)
20 return action
22 return wrapper