Skip to content

Commit ab3f756

Browse files
committed
ensure source image URL is added
1 parent 5e90206 commit ab3f756

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

backend/services/openai_service.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ def extract_events_from_caption(
180180
181181
OCCURRENCE RULES (CRITICAL):
182182
- Every event MUST include at least one occurrence with a concrete UTC start time.
183-
- Return ALL explicit dates and times mentioned in the post as separate entries in the occurrences array.
184-
- DO NOT include registration, signup, RSVP, or application deadlines as occurrences. Only include actual event dates/times.
185-
- Do NOT infer or compress recurrence patterns. List each date/time exactly as given.
183+
- Return explicit dates and times that correspond to events as separate entries in the occurrences array.
184+
- DO NOT include registration, signup, RSVP, or application deadlines as occurrences.
185+
- Do NOT infer or compress recurrence patterns. List each event date/time exactly as given.
186186
- Always convert local times to UTC. The JSON must use ISO 8601 format with a trailing "Z" (e.g., "2025-11-05T22:00:00Z").
187187
- If an end time is not provided, leave "dtend_utc" as an empty string.
188188
- If duration is not explicitly available, leave "duration" as an empty string.
@@ -289,6 +289,10 @@ def extract_events_from_caption(
289289
else:
290290
event_obj[field] = ""
291291

292+
# Ensure source_image_url is set if provided
293+
if source_image_url and not event_obj.get("source_image_url"):
294+
event_obj["source_image_url"] = source_image_url
295+
292296
# Coerce price to 0.0 for free events
293297
price_val = event_obj.get("price")
294298
food_val = (event_obj.get("food") or "").lower()

0 commit comments

Comments
 (0)