我正在使用RASA主讲课程的YouTube频道学习Rasa。https://www.youtube.com/channel/UCJ0V6493mLvqdiVwOKWBODQ。一切都很顺利,直到加载操作时出现问题。每次在命令提示符中使用rasa run actions(两个操作中的第一个)时,程序都会卡住,我必须手动终止它。当我使用rasa shell --endpoints endpoints.yml时,机器人可以正常工作,但是当我添加自定义操作时,服务器会返回无法连接到localhost,就像下面的示例一样。问题是如何解决这个问题。*请询问其他信息。
在 domain.yml 中,对于 actions 部分,我有以下内容;
在endpoints.yml文件中,大部分内容都被注释掉了,但是活动部分是:
我的 actions.py 文件看起来像下面这样:
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.events import SlotSet
class ActionFacilitySearch(Action):
def name(self) -> Text:
return "action_facility_search"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
facility = tracker.get_slot("facility_type")
address = "300 Hyde St, San Francisco"
dispatcher.utter_message("Here is the address of the {}:{}".format(facility, address))
return []
在 domain.yml 中,对于 actions 部分,我有以下内容;
actions:
- utter_greet
- utter_cheer_up
- utter_did_that_help
- utter_happy
- utter_goodbye
- utter_iamabot
- utter_ask_location
- action_facility_search
在endpoints.yml文件中,大部分内容都被注释掉了,但是活动部分是:
action_endpoint:
url: "http://localhost:9000/webhook"