RASA RASA运行操作本地主机问题

2024-05-28 11:16:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用Rasa masterclass youtube频道学习Rasa。https://www.youtube.com/channel/UCJ0V6493mLvqdiVwOKWBODQ

它一直在工作,直到加载动作。每次我在命令提示符下使用rasa run操作(两个操作中的第一个),程序就会卡住,我不得不手动终止它。当我使用rasa shell时——端点端点.yml,bot的工作原理是,当我添加一个自定义操作时,服务器返回cannot connect to localhost,就像下面的示例中一样。问题是我如何通过这个问题。在

*请询问其他信息

:{a2}

我的动作.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 []

在域名.yml,对于我的行动部分

^{pr2}$

在端点.yml,大多数是#'d出,但活动位是:

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

Tags: runtextfromimportyoutubeaddressymlsdk
2条回答

最后答案很简单。我需要运行两个命令窗口。第一个用于:

rasa run actions

然后是第二个窗口:

^{pr2}$

或者

rasa shell

然后这一切就如愿以偿了。在

请不要换端点.yml使用任何其他端口进行操作\u终结点

请检查5055端口是否工作正常。在

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

在5055端口上运行的操作服务器。如果你想让它设置9000,那么把它从rasa核心后端请求中更改。在

相关问题 更多 >