normalize string outputs from time skills
This commit is contained in:
1 parent
f6ef66b532
commit
f05e06e6f6
2 files changed
+2
-15
No files matched your search
@@ -17,5 +17,5 @@ CONTRACT = {}
|
|||||||
|
|
||||||
def act(ctx, request):
|
def act(ctx, request):
|
||||||
today = local_now(ctx.config).date()
|
today = local_now(ctx.config).date()
|
||||||
message = f"Today is {today.strftime('%A, %B %d, %Y')} ({today.isoformat()})."
|
message = f"Today is {today.strftime('%A, %B')} {today.day}, {today.year}."
|
||||||
return ActionResult(action_log=message, new_state=message)
|
return ActionResult(action_log=message, new_state=message)
|
||||||
+1
-14
@@ -9,8 +9,6 @@ the machine itself.
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from semif_agent.skills import ActionResult
|
from semif_agent.skills import ActionResult
|
||||||
from semif_agent.timers import local_now
|
from semif_agent.timers import local_now
|
||||||
|
|
||||||
@@ -19,18 +17,7 @@ INTEGRATION = {"service": "local_clock", "transport": "compute", "config_vars":
|
|||||||
CONTRACT = {}
|
CONTRACT = {}
|
||||||
|
|
||||||
|
|
||||||
def _offset_text(now: datetime) -> str:
|
|
||||||
offset = now.strftime("%z")
|
|
||||||
if not offset:
|
|
||||||
return ""
|
|
||||||
return f" UTC{offset[:3]}:{offset[3:]}"
|
|
||||||
|
|
||||||
|
|
||||||
def act(ctx, request):
|
def act(ctx, request):
|
||||||
now = local_now(ctx.config)
|
now = local_now(ctx.config)
|
||||||
zone = now.tzname() or "local"
|
message = f"It is {now.strftime('%I:%M %p').lstrip('0')}."
|
||||||
message = (
|
|
||||||
f"It is {now.strftime('%H:%M')} "
|
|
||||||
f"({now.strftime('%I:%M %p').lstrip('0')} {zone}{_offset_text(now)})."
|
|
||||||
)
|
|
||||||
return ActionResult(action_log=message, new_state=message)
|
return ActionResult(action_log=message, new_state=message)
|
||||||
Reference in new issue
Block a user