Save review metadata to DB

This commit is contained in:
Nicolas Mowen 2025-08-09 06:29:29 -06:00
parent 8d719ec9cb
commit 48a69c2ffb
3 changed files with 8 additions and 4 deletions

View File

@ -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:

View File

@ -104,6 +104,7 @@ class ReviewDescriptionProcessor(PostProcessorApi):
threading.Thread(
target=run_analysis,
args=(
self.requestor,
self.genai_client,
camera,
final_data,

View File

@ -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)