Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use output_channel of externally triggered intent as input_channel #6272

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion rasa/core/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,16 @@ def apply_to(self, tracker: "DialogueStateTracker") -> None:

@staticmethod
def create_external(
intent_name: Text, entity_list: Optional[List[Dict[Text, Any]]] = None
intent_name: Text,
entity_list: Optional[List[Dict[Text, Any]]] = None,
input_channel: Optional[Text] = None,
) -> "UserUttered":
return UserUttered(
text=f"{EXTERNAL_MESSAGE_PREFIX}{intent_name}",
intent={INTENT_NAME_KEY: intent_name},
metadata={IS_EXTERNAL: True},
entities=entity_list or [],
input_channel=input_channel,
)


Expand Down
6 changes: 5 additions & 1 deletion rasa/core/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,11 @@ async def trigger_external_user_uttered(
f"Invalid entity specification: {entities}. Assuming no entities."
)
entity_list = []
tracker.update(UserUttered.create_external(intent_name, entity_list))
tracker.update(
UserUttered.create_external(
intent_name, entity_list, input_channel=output_channel.name()
)
)
await self._predict_and_execute_next_action(output_channel, tracker)
# save tracker state to continue conversation from this state
self._save_tracker(tracker)
Expand Down