未能填写话语模板 - Rasa Chatbot

Failed to fill utterance template - Rasa Chatbot

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

无法填写 utte运行ce 模板 'Play the game [ ] {mario_link}'。试图替换 'mario_link' 但找不到它的值。没有具有此名称的插槽,您也没有在调用模板时显式传递该值。 Return模板不填模板。

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

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

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

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

    在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()[=28= 打印答案]