Hi, I am trying to tag conversation by metedata after get message from user. And I have wrote a custom action_session_start
Action.
I have tried call RASA-X api in action_session_start
Action and it seems that conversation have not yet been build.
And I also tried to use FollowupAction
event after ActionExecuted("action_listen")
, according rasa-x log, it shows that FollowupAction
is in rasa.core.processor
but my code not run.
Here is my action_session_start
Action:
class ActionSessionStart(Action):
def name(self) -> Text:
return "action_session_start"
async def run(
self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]
) -> List[Dict[Text, Any]]:
events = [SessionStarted()]
events.append(ActionExecuted("action_listen"))
events.append(FollowupAction("action_tag_conversation"))
return events
custom tag action:
class ActionTagCategory(Action):
def name(self):
return "action_tag_conversation"
def run(
self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: DomainDict,
) -> List[EventType]:
value = tracker.get_slot("业务分类")
category_dict = {
"飞机票": "FF7E79",
"专车": "FFD579",
"酒店": "FFFD78",
"火车票": "73FB79",
"商城": "73FEFF",
"打车": "7A81FF",
"企业": "D883FF",
"会员服务": "FF8AD8",
}
color = category_dict[value]
rasax = RasaXAPI()
rasax.tag_convo(
tracker,
json.dumps([{"value": value, "color": color}]),
)
return []