fix: initialize result variable in generate_description_embedding

The result variable is only assigned inside the semantic_search.enabled
and len(new_description) > 0 conditions. If either is false, the return
statement references an undefined variable, raising UnboundLocalError.

Initialize result = None before the conditional block.
This commit is contained in:
ryzendigo 2026-03-17 06:56:21 +08:00
parent 722ef6a1fe
commit 4c30f1e467

View File

@ -1639,6 +1639,7 @@ def generate_description_embedding(
body: EventsDescriptionBody,
):
new_description = body.description
result = None
# If semantic search is enabled, update the index
if request.app.frigate_config.semantic_search.enabled: