rasa-nlu - 如何 curl 访问 RASA NLU(starter-pack-rasa-stack)?
问题描述
通过此链接https://github.com/RasaHQ/starter-pack-rasa-stack
我已经设法使用以下命令启动服务器:make cmdline并成功测试它!
如果我想使用Postman或curl 命令访问我的机器人服务器怎么办?或者我必须编写额外的代码吗?
这是我的方法:
1.制作动作服务器
Narongs-MacBook-Pro:starter-pack-rasa-stack softmastx$ make action-server
python -m rasa_core_sdk.endpoint --actions actions
INFO:__main__:Starting action endpoint server...
ERROR:rasa_core_sdk.executor:Failed to register package 'actions'.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/rasa_core_sdk/executor.py", line 144, in register_package
self._import_submodules(package)
File "/usr/local/lib/python2.7/site-packages/rasa_core_sdk/executor.py", line 131, in _import_submodules
package = importlib.import_module(package)
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "actions.py", line 16, in <module>
from rasa_core.channels.direct import CollectingOutputChannel
ImportError: No module named direct
INFO:__main__:Action endpoint is up and running. on ('0.0.0.0', 5055)
2.制作命令行
2018-10-12 08:22:20.869093: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2018-10-12 08:22:22 INFO root - Rasa Core server is up and running on http://localhost:5005
Bot loaded. Type a message and press enter (use '/stop' to exit):
请指教。谢谢你。
解决方案
make cmdline
不会启动额外的 NLU 服务器。所以你不能直接 curl Rasa NLU API。但是,您可以直接向 Core 发送消息:
curl --request POST \
--url http://localhost:5005/webhooks/rest/webhook \
--header 'content-type: application/json' \
--data '{
"message": "Hello"
}'
如果你想启动一个额外的 NLU 服务器,你必须运行:
python -m rasa_nlu.server --path models/current
然后,您可以使用以下命令 curl Rasa NLU:
curl --request GET \
--url 'http://localhost:5000/parse?q=Hello&project=nlu'
推荐阅读
- python - 如何在颤振中使用训练有素的张量流模型?
- html - 是否可以将 css 添加到嵌入式 Html 页面?
- typescript - loopback4 应用程序在迁移后读取 loopback3 模型
- ssis - SSIS:如何在 SSIS 表达式中使用 getdate() 附加该月最后一天的日期
- image - 以角度向图像添加gps坐标并上传和提取坐标
- r - 按组索引过滤分组 R 数据框中的组
- javascript - 向前传递值时的React-Redux Slider未定义值
- ios - 在 init() 之前或 init() 内部读取 UserDefaults
- oauth-2.0 - Keycloak:缺少参数:code,如何使用POST请求获取Keycloak中的code
- node.js - 将 Node.js 后端添加到 React 项目?