首先运行命令rasa run actions
,然后运行rasa train
,然后运行rasa x
。我犯了一个错误
无法填充话语模板“玩游戏[]{mario_link}”。试图替换“mario_链接”,但找不到该链接的值。没有具有此名称的插槽,也没有在调用模板时显式传递值。返回模板而不填充模板
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
我使用了这些参考资料,但不适用于我:
请帮忙。为什么我会犯这个错误
进行以下更改,它应该可以工作
域中。yml:
在动作中。py
添加这一行
换一个
但我个人会做的是,在这里根本不使用utter_响应,而是使用动作并使用dispatcher.utter_message()打印答案。
完全的反应不应该是动态的。使用动作本身创建动态响应
相关问题 更多 >
编程相关推荐