【问题标题】:Rasa nlu server failureRasa nlu 服务器故障
【发布时间】:2019-08-20 08:39:57
【问题描述】:

我通过在 cmd 中输入以下命令来启动 rasa 服务器:

  rasa run --enable-api -m models/(my_model).tar.gz --cors "*" --debug

我把这个命令放在另一个cmd中:

  curl -X POST localhost:5005/model/parse -d '{"text":"hello"}'

之后我得到了这个错误:

  {"version":"1.2.2","status":"failure","message":"An unexpected error occurred. Error: Failed when parsing body as json","reason":"ParsingError","details":{},"help":null,"code":500}

有什么帮助吗?如何将 Rasa 与 Node.js 集成?

【问题讨论】:

  • rasa run 命令的服务器日志显示了什么?您可能还需要在 curl 请求中设置 json 标头:-H "Content-Type: application/json"

标签: node.js rasa-nlu rasa


【解决方案1】:

请尝试

 curl -H "Content-Type: application/json"  -X POST -d '{"sender":"y1mLd","message":"hi"}' http://localhost:5005/webhooks/rest/webhook

输出将是

[{"recipient_id":"y1mLd","text":"Welcome, Please let me know how I could be a help today!"}]

希望这会有所帮助!

【讨论】:

    【解决方案2】:

    没有方法类型的简单 curl 对我有用:

    curl localhost:5005/model/parse -d '{"text":"hello"}'
    

    【讨论】:

      【解决方案3】:

      我在 Windows 10 上也遇到了这个错误。以下命令终于对我有用。

      curl localhost:5005/model/parse -d "{\"text\":\"hello\"}"
      

      curl -H "Content-Type: application/json" -X POST localhost:5005/model/parse -d "{\"text\":\"hello\"}"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-09-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多