From 15f1c4412bb51c25d0131727c26aa644ec4120f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominic=20Kr=C3=A4mer?= <dominicdaniel3107@gmail.com> Date: Fri, 21 Jun 2024 03:49:55 +0200 Subject: [PATCH] improve api call message --- rasa/actions/actions.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rasa/actions/actions.py b/rasa/actions/actions.py index b5bebba..cb554a7 100644 --- a/rasa/actions/actions.py +++ b/rasa/actions/actions.py @@ -58,6 +58,15 @@ def find_location(timestamp): return smaller_entry +def format_timestamp(location): + parts = location.split(" ") + answer = f"The ISS at time: {parts[0]} will be at:\n \ + x: {parts[1]}\n \ + y: {parts[2]}\n \ + z: {parts[3]}\n" + return answer + + class ActionCurrentIssLocation(Action): def name(self) -> Text: @@ -69,8 +78,8 @@ class ActionCurrentIssLocation(Action): download_file() location = find_location(str(datetime.now())) - - dispatcher.utter_message(text=f"location: {location}") + location = format_timestamp(location) + dispatcher.utter_message(text=f"{location}") return [] @@ -91,7 +100,8 @@ class ActionFutureIssLocation(Action): else: entity = tracker.latest_message['entities'][0]['value'] location = find_location(entity) - dispatcher.utter_message(text=f"location: {location}") + location = format_timestamp(location) + dispatcher.utter_message(text=f"{location}") return [] -- GitLab