feat: Tool para calcular la fecha del dia siguiente.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import asyncio
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from .schemes import ScheduleSchema
|
||||
|
||||
|
||||
TIMEZONE = "America/Bogota"
|
||||
MCP_SERVER_URL = "http://localhost:8000/mcp"
|
||||
MCP_SERVER_URL = "http://localhost:8001/mcp"
|
||||
_MCP_CLIENT = Client(MCP_SERVER_URL)
|
||||
|
||||
|
||||
@@ -27,6 +27,18 @@ class NaliiaTools:
|
||||
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
|
||||
def get_current_datetime() -> str:
|
||||
"""
|
||||
@@ -47,21 +59,23 @@ class NaliiaTools:
|
||||
"""
|
||||
Permite al Cliente al Agendar una Cita
|
||||
"""
|
||||
logger.info("Agendando cita.")
|
||||
logger.info([
|
||||
logger.info("Agendando cita...")
|
||||
|
||||
if not schedule_date and schedule_time:
|
||||
return False
|
||||
|
||||
schedule = datetime.combine(
|
||||
schedule_date,
|
||||
schedule_time,
|
||||
service_center,
|
||||
customer,
|
||||
professional,
|
||||
description
|
||||
])
|
||||
schedule_time
|
||||
).replace(
|
||||
tzinfo=timezone.utc
|
||||
).isoformat()
|
||||
|
||||
example_schedule = {
|
||||
'professional': 6,
|
||||
'description': "Bien Bonito Todo!",
|
||||
'description': description,
|
||||
'customer': 4,
|
||||
'date': '2026-03-25 14:00',
|
||||
'date': schedule,
|
||||
'service_center': 11
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user