RASA - rasa run actions - 本地主机问题

3
我正在使用RASA主讲课程的YouTube频道学习Rasa。https://www.youtube.com/channel/UCJ0V6493mLvqdiVwOKWBODQ。一切都很顺利,直到加载操作时出现问题。每次在命令提示符中使用rasa run actions(两个操作中的第一个)时,程序都会卡住,我必须手动终止它。当我使用rasa shell --endpoints endpoints.yml时,机器人可以正常工作,但是当我添加自定义操作时,服务器会返回无法连接到localhost,就像下面的示例一样。问题是如何解决这个问题。*请询问其他信息。

:enter image description here

我的 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"
6个回答

6

最终的答案非常简单。我需要在两个命令行窗口中运行两个命令。第一个是:

rasa run actions

然后会出现第二个窗口,供选择以下内容之一:
rasa x

或者
rasa shell

然后这个问题被正确地解决了。


2
请勿更改endpoints.yml中的任何其他端口以用于action_endpoint。
请检查5055端口,它可以完美地工作。
action_endpoint:
  url: "http://localhost:5055/webhook"

您的动作服务器运行在5055端口。如果希望将其设置为9000,则需要从Rasa Core后端请求进行更改。


0
在终端1中运行。
rasa actions

在终端2中运行 检查您是否已经将模型放置在models文件夹中,如果没有,请使用
rasa train

然后运行

rasa shell --endpoints endpoints.yml

0
通过查看给定的图像,我认为您想在端口9000上运行操作服务器。
如果确实要在端口9000上运行操作服务器,则需要进行以下更改:

endpoints.yml:

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

运行动作服务器的命令:

rasa run actions -p 9000 --debug

用户可以使用--debug选项检查操作文件中是否存在问题。


0

看起来您的自定义操作服务器无法连接到在endpoints.yml中提到的端点服务器

在运行actions.py时,请提供端口号,如rasa run actions -p portnumber

确保您在此处提供的端口号在endpoints.yml中有提及


0

我通过使用以下命令来解决

rasa run actions

然后出现第二个窗口,供选择:

rasa x

这样做就像应该的那样运行了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接