Why my Rasa Action restart itself without ending?

Viewed 19

I have this action:

class ActionTaxes(Action):

def name(self) -> Text:
    return "action_taxes"

def run(self, dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
    user_agent = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0'}
    r = requests.get(url='https://www.univpm.it/Entra/Tasse_e_contributi', headers= user_agent, verify=False)
    if r.status_code == 200:
        t = r.text
        soup = BeautifulSoup(t, 'html.parser')
        par = soup.find('div', id = 'Contenuti_Pagina')
        output = str(html2text.html2text(str(par)))
        dispatcher.utter_message(text=output)
        dispatcher.utter_message(text='Unreachable')
    return []

When the dispatcher.utter_message(text=output) is uncommented the the action ALWAYS restart from the beginning without never reaching the line below dispatcher.utter_message(text=Unreachable) so i have infinite outputs until i stop the server. If i comment the dispatcher.utter_message(text=output), it reaches the 'Unreachable' line and terminates correctly. How is it possible?

0 Answers
Related