运行操作服务(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.
本文档介绍了如何启动Rasa SDK的操作服务。如果已安装rasa,使用`rasa run actions`命令;若未安装,可以运行`python -m rasa_sdk --actions actions`。服务默认查找actions.py或actions包中的操作。可选参数包括设置端口、启用CORS、指定动作包等。启用自动重载可监控Action子类变化。此外,提供了日志级别控制选项。
675

被折叠的 条评论
为什么被折叠?



