代码之家  ›  专栏  ›  技术社区  ›  webmastx

如何卷曲访问RASA NLU(入门包RASA堆栈)?

  •  0
  • webmastx  · 技术社区  · 8 年前

    使用此链接 https://github.com/RasaHQ/starter-pack-rasa-stack

    我已使用以下命令启动服务器: 生成命令行 并用 成功 !

    如果我想使用 邮递员 或 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): 
    

    请告知。谢谢您。

    1 回复  |  直到 7 年前
        1
  •  0
  •   Tobias    7 年前

    make cmdline 不启动额外的NLU服务器。所以不能直接卷曲RASA NLU API。 但是,您可以直接向核心发送消息:

    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
    

    然后,您可以将RASA NLU卷曲为:

    curl --request GET \
      --url 'http://localhost:5000/parse?q=Hello&project=nlu'