[507a54]: / production / action-server / actions / intent_set.py

Download this file

19 lines (12 with data), 511 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.events import SlotSet
from rasa_sdk.executor import CollectingDispatcher
class IntentSet(Action):
def name(self) -> Text:
return "intent_set"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
intent = tracker.latest_message['intent']['name']
return [SlotSet("intent_name", intent)]