Skip to content

Commit

Permalink
Merge pull request #148 from PerfectFit-project/405-videos-waiting-time
Browse files Browse the repository at this point in the history
fixed video waiting time
  • Loading branch information
wbaccinelli authored Aug 4, 2023
2 parents c48991c + b9088f8 commit 97dff13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
14 changes: 4 additions & 10 deletions Rasa_Bot/actions/actions_watching_a_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.forms import FormValidationAction
from typing import Text, Dict, Any
from virtual_coach_db.helper.definitions import (VideoLinks, Components, ComponentsTriggers,
DialogExpectedDuration)
from virtual_coach_db.helper.definitions import (VideoLinks, Components, ComponentsTriggers)
from . import validator
from .definitions import PAUSE_AND_TRIGGER, REDIS_URL, TRIGGER_INTENT
from .definitions import PAUSE_AND_TRIGGER, REDIS_URL, TRIGGER_INTENT, PAUSE_TIME
from .helper import get_latest_bot_utterance

celery = Celery(broker=REDIS_URL)
Expand Down Expand Up @@ -76,13 +75,8 @@ async def run(self, dispatcher, tracker, domain):
user_id = int(tracker.current_state()['sender_id']) # retrieve userID
new_intent = ComponentsTriggers.DONE_VIDEO

dialog = str(tracker.get_slot('current_intervention_component'))
try:
duration = (DialogExpectedDuration[dialog]) * 60
except Exception:
duration = 30

time = datetime.datetime.now() + datetime.timedelta(seconds=duration)
# PAUSE_TIME waiting time after the video link is sent
time = datetime.datetime.now() + datetime.timedelta(seconds=PAUSE_TIME)
celery.send_task(PAUSE_AND_TRIGGER,
(user_id, new_intent, time))
return []
Expand Down
3 changes: 3 additions & 0 deletions Rasa_Bot/actions/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
AFTERNOON_SEND_TIME = 16
EVENING_SEND_TIME = 21

# Length of the pause in seconds before resuming the conversation after a video
PAUSE_TIME = 60

# Daypart names in Dutch
DAYPART_NAMES_DUTCH = ["ochtend", "middag", "avond"]

Expand Down

0 comments on commit 97dff13

Please sign in to comment.