Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
wochinge committed Nov 3, 2020
1 parent d278dea commit 432771f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
8 changes: 4 additions & 4 deletions changelog/7068.improvement.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Slot mappings for [Forms](forms.mdx) in the domain are now optional. If you do not
provide any slot mappings as part within the domain, you need to provide
Slot mappings for [Forms](forms.mdx) in the domain are now optional. If you do not
provide any slot mappings as part of the domain, you need to provide
[custom slot mappings](forms.mdx#custom-slot-mappings) through a custom action.
A form without slot mappings is specified as follows:

Expand All @@ -10,7 +10,7 @@ forms:
```

The action for [forms](forms.mdx) can now be overridden by defining a custom action
with the same name as the form. This can be used to keep using the deprecated
with the same name as the form. This can be used to keep using the deprecated
Rasa Open Source `FormAction` which is implemented within the Rasa SDK. Note that it is
**not** recommended to override the form action for anything else than using the
**not** recommended to override the form action for anything else than using the
deprecated Rasa SDK `FormAction`.
11 changes: 10 additions & 1 deletion rasa/core/actions/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,17 @@ def action_from_name(
action_endpoint: Optional[EndpointConfig],
retrieval_intents: Optional[List[Text]] = None,
) -> "Action":
"""Return an action instance for the name."""
"""Retrieves an action by its name.
Args:
name: The name of the action.
domain: The current model domain.
action_endpoint: The endpoint to execute custom actions.
retrieval_intents: Retrieval intents used by the current model.
Returns:
The instantiated action.
"""
defaults = {a.name(): a for a in default_actions(action_endpoint)}

if name in defaults and name not in domain.user_actions_and_forms:
Expand Down
15 changes: 8 additions & 7 deletions rasa/shared/core/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,13 +601,13 @@ def _initialize_forms(
if isinstance(forms, list) and (not forms or isinstance(forms[0], str)):
# list of form names (Rasa Open Source 1 format)
rasa.shared.utils.io.raise_warning(
f"The `forms` section in the domain used the old Rasa Open Source 1 "
f"list format to define forms. Rasa Open Source will be configured to "
f"use the deprecated `FormAction` within the Rasa SDK. If you want to "
f"use the new Rasa Open Source 2 `FormAction` adapt your `forms`"
f"section as described in the documentation. Support for the "
f"deprecated `FormAction` in the Rasa SDK will be removed in Rasa Open "
f"Source 3.0.",
"The `forms` section in the domain used the old Rasa Open Source 1 "
"list format to define forms. Rasa Open Source will be configured to "
"use the deprecated `FormAction` within the Rasa SDK. If you want to "
"use the new Rasa Open Source 2 `FormAction` adapt your `forms` "
"section as described in the documentation. Support for the "
"deprecated `FormAction` in the Rasa SDK will be removed in Rasa Open "
"Source 3.0.",
docs=rasa.shared.constants.DOCS_URL_FORMS,
category=FutureWarning,
)
Expand All @@ -622,6 +622,7 @@ def _initialize_forms(
return [], {}, []

def __hash__(self) -> int:
"""Returns a unique hash for the domain."""
self_as_dict = self.as_dict()
self_as_dict[
KEY_INTENTS
Expand Down

0 comments on commit 432771f

Please sign in to comment.