我想在会话开始时收集用户名,并且我尝试使用某些帖子中建议的“ action_session_start”来实现。 我还没有部署。我正在使用“ rasa shell”和“ rasa x”来查看结果 我进行了操作,有一个“用户名”插槽,还有“ utter_ask_username”模板。但是Bot不会使用此操作中的任何内容,而是等待用户输入,即使在第一次输入之后,它也不会询问用户名。我究竟做错了什么。您能否分享一些Bot提出一些问题来填补空缺的示例。谢谢
class ActionSessionStart(Action):
def name(self) -> Text:
return "action_session_start"
@staticmethod
def fetch_slots(tracker: Tracker) -> List[EventType]:
"""Collect slots that contain the user's name and phone number."""
slots = []
logger.info("keeping only name/phone_number slots")
for key in ("username"):
value = tracker.get_slot(key)
if value is not None:
slots.append(SlotSet(key=key, value=value))
return slots
async def run(
self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]
) -> List[Dict[Text, Any]]:
# the session should begin with a `session_started` event
events = [SessionStarted()]
# any slots that should be carried over should come after the
# `session_started` event
events.extend(self.fetch_slots(tracker))
# an `action_listen` should be added at the end as a user message follows
events.append(ActionExecuted("action_listen"))
return events