pythonrasa-corerasa

RASA - rasa run actions - localhost issues


I am learning Rasa using the RASA masterclass youtube channel. https://www.youtube.com/channel/UCJ0V6493mLvqdiVwOKWBODQ

It has all worked until it has come to loading actions. Each time I use rasa run actions in the command prompt (the first of the two actions) the program gets stuck and I have to manually kill it. When I use rasa shell --endpoints endpoints.yml, bot works however as I keep encountering when I add in a custom action the server returns cannot connect to localhost like in the bottom example. The question is how to I get passed this issue.

*Please ask for additional info

:enter image description here

my actions.py looks like the below:

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 []

in domain.yml, for the actions section I have;

actions:
- utter_greet
- utter_cheer_up
- utter_did_that_help
- utter_happy
- utter_goodbye
- utter_iamabot
- utter_ask_location
- action_facility_search

and in endpoints.yml, most is #'d out but the active bit is:

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

Solution

  • Very simple answer in the end. I needed to run two commands windows. The first one for:

    rasa run actions
    

    Then a second window for either:

    rasa x
    

    or

    rasa shell
    

    this then worked as it should.