Intención: Dar la hora
actions.py
import datetime as dt
from typing import Any, Text, Dict, Listfrom rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcherclass ActionHelloWorld(Action): def name(self) -> Text:
return "action_show_time" def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text=f"{dt.datetime.now()}") return []
nlu.yml
version: "2.0"nlu:
- intent: give_time
examples: |
- can you tell me what time it is
- tell me the time
- got the time
- what time is it
stories.yml
version: "2.0"stories:- story: path about time
steps:
- intent: greet
- action: utter_greet
- intent: give_time
- action: action_show_time
domain.yml
version: "2.0"intents:
- give_timeactions:
- action_show_time