diff --git a/frigate/api/defs/events_body.py b/frigate/api/defs/events_body.py index 7aef87433..ca1256598 100644 --- a/frigate/api/defs/events_body.py +++ b/frigate/api/defs/events_body.py @@ -11,9 +11,7 @@ class EventsSubLabelBody(BaseModel): class EventsDescriptionBody(BaseModel): - description: Union[str, None] = Field( - title="The description of the event", min_length=1 - ) + description: Union[str, None] = Field(title="The description of the event") class EventsCreateBody(BaseModel): diff --git a/frigate/api/event.py b/frigate/api/event.py index 3be37539d..ca531d098 100644 --- a/frigate/api/event.py +++ b/frigate/api/event.py @@ -927,27 +927,19 @@ def set_description( new_description = body.description - if new_description is None or len(new_description) == 0: - return JSONResponse( - content=( - { - "success": False, - "message": "description cannot be empty", - } - ), - status_code=400, - ) - event.data["description"] = new_description event.save() # If semantic search is enabled, update the index if request.app.frigate_config.semantic_search.enabled: context: EmbeddingsContext = request.app.embeddings - context.update_description( - event_id, - new_description, - ) + if len(new_description) > 0: + context.update_description( + event_id, + new_description, + ) + else: + context.db.delete_embeddings_description(event_id) response_message = ( f"Event {event_id} description is now blank"