Miscellaneous fixes (#21373)

* Send preferred language for report service

* make object lifecycle scrollable in tracking details

* fix info popovers in live camera drawer

* ensure metrics are initialized if genai is enabled

* docs

* ollama cloud model docs

* Ensure object descriptions get claened up

---------

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
This commit is contained in:
Nicolas Mowen
2025-12-20 17:30:34 -07:00
committed by GitHub
parent 8a4d5f34da
commit 54f4af3c6a
11 changed files with 144 additions and 110 deletions

View File

@@ -131,6 +131,8 @@ class ObjectDescriptionProcessor(PostProcessorApi):
)
):
self._process_genai_description(event, camera_config, thumbnail)
else:
self.cleanup_event(event.id)
def __regenerate_description(self, event_id: str, source: str, force: bool) -> None:
"""Regenerate the description for an event."""
@@ -204,6 +206,17 @@ class ObjectDescriptionProcessor(PostProcessorApi):
)
return None
def cleanup_event(self, event_id: str) -> None:
"""Clean up tracked event data to prevent memory leaks.
This should be called when an event ends, regardless of whether
genai processing is triggered.
"""
if event_id in self.tracked_events:
del self.tracked_events[event_id]
if event_id in self.early_request_sent:
del self.early_request_sent[event_id]
def _read_and_crop_snapshot(self, event: Event) -> bytes | None:
"""Read, decode, and crop the snapshot image."""
@@ -299,9 +312,8 @@ class ObjectDescriptionProcessor(PostProcessorApi):
),
).start()
# Delete tracked events based on the event_id
if event.id in self.tracked_events:
del self.tracked_events[event.id]
# Clean up tracked events and early request state
self.cleanup_event(event.id)
def _genai_embed_description(self, event: Event, thumbnails: list[bytes]) -> None:
"""Embed the description for an event."""

View File

@@ -311,6 +311,7 @@ class ReviewDescriptionProcessor(PostProcessorApi):
start_ts,
end_ts,
events_with_context,
self.config.review.genai.preferred_language,
self.config.review.genai.debug_save_thumbnails,
)
else: