Rasa chatbot无法访问weatherapixu API

2024-04-28 14:49:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我的天气机器人一直有个问题。除了在指定地点后做天气预报的动作外,对话效果很好,这实际上是主要的动作。我用Apixu做天气预报

当我运行在线培训时,我得到以下错误:

ERROR:rasa_core.processor:Encountered an exception while running action 'action_weather'. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code.

这是我用于天气预报操作的python脚本:

^{pr2}$

这是我的天气域文件,是一个yaml文件

 slots:   location:
     type: text


 intents:
  - greet
  - goodbye
  - inform


 entities:
  - location

 templates:   utter_greet:
     - 'Hello! How can I help?'   utter_goodbye:
     - 'Talk to you later.'
     - 'Bye bye :('   utter_ask_location:
     - 'In what location?'



 actions:
  - utter_greet
  - utter_goodbye
  - utter_ask_location
  - actions.ActionWeather

有什么想法吗?在


Tags: 文件thetoactionsexception机器人actionlocation
1条回答
网友
1楼 · 发布于 2024-04-28 14:49:34

由于bot是在Python中的,所以程序使用拉梅尔亚姆勒或者PyYAML来解析YAML文件。在

如果您试图解析YAML文件,很明显第一行无效:

import ruamel.yaml
yaml = ruamel.yaml.YAML()

yaml_str = """\
 slots:   location:
     type: text
"""

data = yaml.load(yaml_str)

给出:

^{pr2}$

你也可以试试这个online。在

你的机器人很可能会捕捉到这些错误,但却没有对它们采取适当的措施。在

相关问题 更多 >