运行操作服务(action server)有两种方法,具体取决于您使用的环境是否安装了rasa
:
如果安装了rasa
,则可以使用rasa
命令运行操作服务:
rasa run actions
如果未安装rasa
,则可以直接将操作服务作为python模块运行:
python -m rasa_sdk --actions actions
使用上面的命令,rasa_sdk
将期望在名为actions.py
的文件或名为actions
的包目录中找到您的操作。可以使用--actions
标志指定不同的actions
模块或包。
使用命令运行操作服务的参数列表如下:
usage: __main__.py [-h] [-p PORT] [--cors [CORS [CORS ...]]]
[--actions ACTIONS] [--ssl-keyfile SSL_KEYFILE]
[--ssl-certificate SSL_CERTIFICATE]
[--ssl-password SSL_PASSWORD] [--auto-reload] [-v] [-vv]
[--quiet] [--log-file LOG_FILE]
starts the action endpoint
optional arguments:
-h, --help show this help message and exit
-p PORT, --port PORT port to run the server at
--cors [CORS [CORS ...]]
enable CORS for the passed origin. Use * to whitelist
all origins
--actions ACTIONS name of action package to be loaded
--ssl-keyfile SSL_KEYFILE
Set the SSL certificate to create a TLS secured
server.
--ssl-certificate SSL_CERTIFICATE
Set the SSL certificate to create a TLS secured
server.
--ssl-password SSL_PASSWORD
If your ssl-keyfile is protected by a password, you
can specify it using this paramer.
--auto-reload Enable auto-reloading of modules containing Action
subclasses.
-v, --verbose Be verbose. Sets logging level to INFO
-vv, --debug Print lots of debugging statements. Sets logging level
to DEBUG
--quiet Be quiet! Sets logging level to WARNING
--log-file LOG_FILE Store logs in specified file.