From ff4eba5b581dea44dacbb314d777f24944234510 Mon Sep 17 00:00:00 2001 From: Nupur Khare Date: Mon, 20 Nov 2023 11:47:59 +0530 Subject: [PATCH] 1. Added croniter in Dockerfile_action_server. 2. Added default=None in Path. --- docker/Dockerfile_action_server | 1 + kairon/api/app/routers/bot/bot.py | 2 +- kairon/events/server.py | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile_action_server b/docker/Dockerfile_action_server index f33585ec5..2cba126b7 100644 --- a/docker/Dockerfile_action_server +++ b/docker/Dockerfile_action_server @@ -22,6 +22,7 @@ RUN python -m pip install websockets==9.1 RUN python -m pip install aiohttp==3.8.0 RUN python -m pip install json2html RUN python -m pip install numpy==1.22.0 +RUN python -m pip install croniter RUN python -m pip install ujson==5.1.0 RUN python -m pip install Pillow==9.0.0 RUN python -m pip install blinker diff --git a/kairon/api/app/routers/bot/bot.py b/kairon/api/app/routers/bot/bot.py index 0062f4d24..6fd2a28be 100644 --- a/kairon/api/app/routers/bot/bot.py +++ b/kairon/api/app/routers/bot/bot.py @@ -513,7 +513,7 @@ async def train( @router.post("/abort/{event_type}", response_model=Response) async def abort_event( - event_type: EventClass = Path(description="Event type", example=[e.value for e in EventClass]), + event_type: EventClass = Path(default=None, description="Event type", example=[e.value for e in EventClass]), current_user: User = Security(Authentication.get_current_user_and_bot, scopes=DESIGNER_ACCESS), ): """ diff --git a/kairon/events/server.py b/kairon/events/server.py index 36a70e422..4ff076c70 100644 --- a/kairon/events/server.py +++ b/kairon/events/server.py @@ -121,7 +121,7 @@ def index(): def add_event( request: EventRequest, is_scheduled: bool = Query(description="Whether the event is to be run once or scheduled"), - event_type: EventClass = Path(description="Event type", example=[e.value for e in EventClass]) + event_type: EventClass = Path(default=None, description="Event type", example=[e.value for e in EventClass]) ): request.validate_request(is_scheduled, event_type) response, message = EventUtility.add_job(event_type, request.dict(), is_scheduled) @@ -132,7 +132,7 @@ def add_event( def update_scheduled_event( request: EventRequest, is_scheduled: bool = Query(description="Whether the event is to be run once or scheduled"), - event_type: EventClass = Path(description="Event type", example=[e.value for e in EventClass]) + event_type: EventClass = Path(default=None, description="Event type", example=[e.value for e in EventClass]) ): request.validate_request(is_scheduled, event_type) response, message = EventUtility.update_job(event_type, request.dict(), is_scheduled) @@ -140,5 +140,5 @@ def update_scheduled_event( @app.delete("/api/events/{event_id}", response_model=Response) -def delete_scheduled_event(event_id: Text = Path(description="Event id")): +def delete_scheduled_event(event_id: Text = Path(default=None, description="Event id")): return {"data": KScheduler().delete_job(event_id), "message": "Scheduled event deleted!"}