Ruby/model/scheduler.py
2025-04-26 22:34:05 -04:00

20 lines
509 B
Python

import time
_next_action_time = time.time() + 60 # default 1 minute from now
_next_action_label = "Waiting"
def set_next_action(seconds_from_now: int, label: str = "Thinking"):
global _next_action_time, _next_action_label
_next_action_time = time.time() + seconds_from_now
_next_action_label = label
def get_time_until_next_action() -> int:
remaining = int(_next_action_time - time.time())
return max(0, remaining)
def get_next_action_label() -> str:
return _next_action_label