feat: Tool para calcular la fecha del dia siguiente.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from datetime import datetime
|
from datetime import datetime, timedelta, timezone
|
||||||
from zoneinfo import ZoneInfo
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ from .schemes import ScheduleSchema
|
|||||||
|
|
||||||
|
|
||||||
TIMEZONE = "America/Bogota"
|
TIMEZONE = "America/Bogota"
|
||||||
MCP_SERVER_URL = "http://localhost:8000/mcp"
|
MCP_SERVER_URL = "http://localhost:8001/mcp"
|
||||||
_MCP_CLIENT = Client(MCP_SERVER_URL)
|
_MCP_CLIENT = Client(MCP_SERVER_URL)
|
||||||
|
|
||||||
|
|
||||||
@@ -27,6 +27,18 @@ class NaliiaTools:
|
|||||||
self.schedule_appointment
|
self.schedule_appointment
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@tool
|
||||||
|
def get_tomorrow_date() -> str:
|
||||||
|
"""
|
||||||
|
Consulta la fecha y hora actual del sistema y calcula la fecha del dia de mañana.
|
||||||
|
Retorna la fecha en formato ISO 8601. No se aceptan fechas en el pasado con respecto a esta fecha.
|
||||||
|
"""
|
||||||
|
|
||||||
|
td = timedelta(days=1)
|
||||||
|
tomorrow = datetime.now().date + td
|
||||||
|
|
||||||
|
return tomorrow
|
||||||
|
|
||||||
@tool
|
@tool
|
||||||
def get_current_datetime() -> str:
|
def get_current_datetime() -> str:
|
||||||
"""
|
"""
|
||||||
@@ -47,21 +59,23 @@ class NaliiaTools:
|
|||||||
"""
|
"""
|
||||||
Permite al Cliente al Agendar una Cita
|
Permite al Cliente al Agendar una Cita
|
||||||
"""
|
"""
|
||||||
logger.info("Agendando cita.")
|
logger.info("Agendando cita...")
|
||||||
logger.info([
|
|
||||||
|
if not schedule_date and schedule_time:
|
||||||
|
return False
|
||||||
|
|
||||||
|
schedule = datetime.combine(
|
||||||
schedule_date,
|
schedule_date,
|
||||||
schedule_time,
|
schedule_time
|
||||||
service_center,
|
).replace(
|
||||||
customer,
|
tzinfo=timezone.utc
|
||||||
professional,
|
).isoformat()
|
||||||
description
|
|
||||||
])
|
|
||||||
|
|
||||||
example_schedule = {
|
example_schedule = {
|
||||||
'professional': 6,
|
'professional': 6,
|
||||||
'description': "Bien Bonito Todo!",
|
'description': description,
|
||||||
'customer': 4,
|
'customer': 4,
|
||||||
'date': '2026-03-25 14:00',
|
'date': schedule,
|
||||||
'service_center': 11
|
'service_center': 11
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user