mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 07:35:27 +03:00
Allow tracked object description to be saved as an empty string
This commit is contained in:
parent
dd6276e706
commit
a2e173d730
@ -11,9 +11,7 @@ class EventsSubLabelBody(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class EventsDescriptionBody(BaseModel):
|
class EventsDescriptionBody(BaseModel):
|
||||||
description: Union[str, None] = Field(
|
description: Union[str, None] = Field(title="The description of the event")
|
||||||
title="The description of the event", min_length=1
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class EventsCreateBody(BaseModel):
|
class EventsCreateBody(BaseModel):
|
||||||
|
|||||||
@ -927,27 +927,19 @@ def set_description(
|
|||||||
|
|
||||||
new_description = body.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.data["description"] = new_description
|
||||||
event.save()
|
event.save()
|
||||||
|
|
||||||
# If semantic search is enabled, update the index
|
# If semantic search is enabled, update the index
|
||||||
if request.app.frigate_config.semantic_search.enabled:
|
if request.app.frigate_config.semantic_search.enabled:
|
||||||
context: EmbeddingsContext = request.app.embeddings
|
context: EmbeddingsContext = request.app.embeddings
|
||||||
context.update_description(
|
if len(new_description) > 0:
|
||||||
event_id,
|
context.update_description(
|
||||||
new_description,
|
event_id,
|
||||||
)
|
new_description,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
context.db.delete_embeddings_description(event_id)
|
||||||
|
|
||||||
response_message = (
|
response_message = (
|
||||||
f"Event {event_id} description is now blank"
|
f"Event {event_id} description is now blank"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user