-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into abstract_forms
- Loading branch information
Showing
9 changed files
with
121 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import argparse | ||
|
||
from rasa_core_sdk.constants import DEFAULT_SERVER_PORT | ||
|
||
|
||
def action_arg(action): | ||
if "/" in action: | ||
raise argparse.ArgumentTypeError( | ||
'Invalid actions format. Actions file should be a python module ' | ||
'and passed with module notation (e.g. directory.actions).') | ||
else: | ||
return action | ||
|
||
|
||
def add_endpoint_arguments(parser): | ||
parser.add_argument( | ||
'-p', '--port', | ||
default=DEFAULT_SERVER_PORT, | ||
type=int, | ||
help="port to run the server at") | ||
parser.add_argument( | ||
'--cors', | ||
nargs='*', | ||
type=str, | ||
help="enable CORS for the passed origin. " | ||
"Use * to whitelist all origins") | ||
parser.add_argument( | ||
'--actions', | ||
type=action_arg, | ||
default=None, | ||
help="name of action package to be loaded" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DEFAULT_SERVER_PORT = 5055 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
from __future__ import unicode_literals | ||
|
||
from rasa_core_sdk import Tracker | ||
from rasa_core_sdk.events import ActionExecuted, UserUttered | ||
|
||
|
||
def test_latest_input_channel(): | ||
tracker = Tracker('default', {}, | ||
{'intent': {'name': 'some_intent', 'confidence': 1.0}}, | ||
[UserUttered("my message text", | ||
input_channel="superchat"), | ||
ActionExecuted("action_listen")], | ||
False, None, {}, 'action_listen') | ||
|
||
assert tracker.get_latest_input_channel() == "superchat" |