From 48a69c2ffbfec810e0c01734f94e13b590ec639c Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Sat, 9 Aug 2025 06:29:29 -0600 Subject: [PATCH] Save review metadata to DB --- frigate/comms/dispatcher.py | 7 ++++++- frigate/data_processing/post/review_descriptions.py | 1 + frigate/genai/__init__.py | 4 +--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frigate/comms/dispatcher.py b/frigate/comms/dispatcher.py index 27855a575..bd6161108 100644 --- a/frigate/comms/dispatcher.py +++ b/frigate/comms/dispatcher.py @@ -151,7 +151,12 @@ class Dispatcher: ) def handle_update_review_description() -> None: - logger.info(f"received review genai data {payload}") + final_data = payload["after"] + ReviewSegment.insert(final_data).on_conflict( + conflict_target=[ReviewSegment.id], + update=final_data, + ).execute() + self.publish("reviews", payload) def handle_update_model_state() -> None: if payload: diff --git a/frigate/data_processing/post/review_descriptions.py b/frigate/data_processing/post/review_descriptions.py index f9f359df4..796561698 100644 --- a/frigate/data_processing/post/review_descriptions.py +++ b/frigate/data_processing/post/review_descriptions.py @@ -104,6 +104,7 @@ class ReviewDescriptionProcessor(PostProcessorApi): threading.Thread( target=run_analysis, args=( + self.requestor, self.genai_client, camera, final_data, diff --git a/frigate/genai/__init__.py b/frigate/genai/__init__.py index e2d036119..3f4856971 100644 --- a/frigate/genai/__init__.py +++ b/frigate/genai/__init__.py @@ -65,9 +65,7 @@ class GenAIClient: Omit this field entirely if there is no observable security concern. **IMPORTANT:** - - Values for each field must be plain strings or integers — no nested objects or explanatory text. - - The JSON must strictly match this structure: - {ReviewMetadata.model_json_schema()["properties"]} + Values for each field must be plain strings or integers — no nested objects or explanatory text. """ response = self._send(context_prompt, thumbnails)