【问题标题】:Failed to fill utterance template - Rasa Chatbot无法填写话语模板 - Rasa Chatbot
【发布时间】:2020-11-21 13:14:57
【问题描述】:

首先我运行命令rasa run actions,然后运行rasa train,然后运行rasa x。我收到一个错误。

未能填写话语模板“玩游戏 [ ] {mario_link}”。试图替换“mario_link”,但找不到它的值。没有具有此名称的插槽,也没有在调用模板时显式传递值。返回模板而不填写模板。

domain.yml 文件

session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true
intents:
- mario
responses:
  utter_game_mario:
  - text: Play the game [ ] {mario_link}
actions:
- action_mario

actions.py 文件

from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher


class ActionHelloWorld(Action):
    def name(self) -> Text:
        return "action_mario"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
            # dispatcher.utter_message(text="Hello World!")

            link = "https://supermarioemulator.com/supermario.php"

            dispatcher.utter_template("utter_game_mario", tracker, link=link)
            return []

nlu.md 文件

## intent:mario
- i want to play mario
- start mario
- play mario

endpoints.yml 文件

action_endpoint:
  url: "http://localhost:5055/webhook"

stories.md 文件

## game
* mario
    - action_mario

我使用了这些参考资料,但对我不起作用:

  • 重新安装最新版本的 Rasa:https://forum.rasa.com/t/getting-an-error-while-using-custom-output-payload/11802

  • 不知道这里有什么解决方案:https://github.com/RasaHQ/rasa/issues/4550

  • 这没有任何意义:https://github.com/RasaHQ/rasa/pull/4079/files/6c14ab262e915369915876425670843ab348201e

  • 请帮忙。为什么会出现此错误?

    【问题讨论】:

      标签: python rasa-nlu rasa-core rasa rasa-x


      【解决方案1】:

      进行以下更改,它应该可以工作

      在 domain.yml 中:

      - text: Play the game {mario_link}
      

      在actions.py中

      添加这一行

      tracker.get_slot('mario_link')
      

      然后改变这个

      dispatcher.utter_template("utter_game_mario", tracker, mario_link=link)
      

      但我个人会在这里完全不使用 utter_response,而只是使用操作并使用 dispatcher.utter_message()

      打印答案

      【讨论】:

        【解决方案2】:

        完全的反应不应该是动态的。单独使用动作来创建动态响应。

        【讨论】:

        • 我没有在我的 stories.md 文件中使用操作作为响应吗?
        • 是的。我的建议是在没有完全回应的情况下单独使用它
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-18
        • 1970-01-01
        • 2020-06-29
        • 1970-01-01
        • 1970-01-01
        • 2020-08-07
        相关资源
        最近更新 更多