Hello, I have been following the steps you provided and the documentation for external events. First, I have a form “validate_doc_generation_questions_form” where I receive four answers from the user and save them in different slots (respuesta1, respuesta2, respuesta3, respuesta4). The form doesn’t end until all four slots are completed. After completing the form, I have set an action “action_confirm_document” that retrieves the values of these slots and sends them via POST to a Python API which receives these four variables, processes them accordingly, and triggers an intent called “set_document_text,” returning the result in a single variable “short_url” to the Rasa server as follows:
rasa_endpoint = f"http://localhost:5005/conversations/{sender_id}/trigger_intent?output_channel=latest"
headers = {'Content-Type': 'application/json'}
response = {
"name": "set_document_text",
"entities": {
"document_url": short_url
}
}
try:
response = requests.post(rasa_endpoint, json=response, headers=headers)
except requests.RequestException as e:
print(f"Error: {e}")
return {"status": "fail"}
I have defined the entity and the slot in the domain.yml as follows:
entities:
- document_url
document_url:
type: text
influence_conversation: false
mappings:
- type: from_entity
entity: document_url
Additionally, I have defined a rule for that specific intent in the following way:
- rule: Set Document Text
steps:
- intent: set_document_text
- action: action_document_text
In the custom action “action_document_text,” which is triggered by the intent, the value of the entity or slot “document_url” is printed using the tracker and dispatcher as follows:
class ActionDocumentText(Action):
def name(self) -> Text:
return "action_document_text"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
doc_url = tracker.get_slot("document_url")
dispatcher.utter_message(text=f"You can access the generated document at the following link: {doc_url}")
The process of sending information to the API and the processes within the API are executed correctly. However, when I try to send back the intent and the value of the entity to the Rasa server, it gets stuck at this point and doesn’t move to the next action where the API result is expected to be printed. It remains stuck at the line after the try where the request is made: response = requests.post(rasa_endpoint, json=response, headers=headers)
These are the logs on the Rasa server:
It seems as though it’s as if the form is being reactivated and the last slot “respuesta4” is being filled again, even though it had already been completed entirely and had moved on to the next action.