我正在使用 RASA 大师类 YouTube channel 学习 Rasa。 https://www.youtube.com/channel/UCJ0V6493mLvqdiVwOKWBODQ
一切都在进行,直到加载操作为止。每次我在命令提示符中使用 rasa run 操作(两个操作中的第一个)时,程序都会卡住,我必须手动终止它。当我使用 rasa shell --endpoints 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:
- utter_greet
- utter_cheer_up
- utter_did_that_help
- utter_happy
- utter_goodbye
- utter_iamabot
- utter_ask_location
- action_facility_search
在endpoints.yml中,大部分内容已被#'d淘汰,但事件位是:
action_endpoint:
url: "http://localhost:9000/webhook"
最佳答案
最后的答案非常简单。我需要运行两个命令窗口。第一个用于:
rasa run actions
然后是第二个窗口:
rasa x
或
rasa shell
然后就可以正常工作了。
关于python - RASA - rasa 运行操作 - 本地主机问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58969678/