Extract per-menu schedule in extract_page mode

- Claude prompt now asks for menuSchedule (days/times this menu is served)
- Separates menu schedule from overall business hours
- Returns menuSchedule in response for frontend to use

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-03-14 17:45:05 -07:00
parent 571930ed25
commit a14213151f

View file

@ -245,7 +245,7 @@ try {
}
// Send to Claude for this single menu page
$singlePrompt = 'You are an expert at extracting structured menu data from restaurant website HTML. Extract ALL menu items visible in the HTML. Return valid JSON with these keys: business (object with name, address, phone, hours, brandColor), categories (array of category name strings), items (array of objects with name, description, price, category, imageUrl). CATEGORIES vs ITEMS (CRITICAL): A CATEGORY is a broad section heading that groups items. An ITEM is an individual food/drink with name, description, and price. Each item must have a \'category\' field. For prices: numbers (e.g., 12.99). For imageUrl: the full src URL of the food image from the HTML. For brandColor: suggest a vibrant hex (6 digits, no hash). Return ONLY valid JSON.';
$singlePrompt = 'You are an expert at extracting structured menu data from restaurant website HTML. Extract ALL menu items visible in the HTML. Return valid JSON with these keys: business (object with name, address, phone, hours, brandColor), menuSchedule (string — the days/times THIS specific menu is served, e.g. "Mon-Fri 11am-3pm" or "Sat-Sun 10am-2pm"), categories (array of category name strings), items (array of objects with name, description, price, category, imageUrl). MENU SCHEDULE: Look for text indicating when this menu is available — phrases like "Served Mon-Fri 11am-3pm", "Available weekends", "Daily 5pm-10pm", etc. Put this in menuSchedule. The business hours field is for the restaurant\'s OVERALL operating hours (if visible). CATEGORIES vs ITEMS (CRITICAL): A CATEGORY is a broad section heading that groups items. An ITEM is an individual food/drink with name, description, and price. Each item must have a \'category\' field. For prices: numbers (e.g., 12.99). For imageUrl: the full src URL of the food image from the HTML. For brandColor: suggest a vibrant hex (6 digits, no hash). Return ONLY valid JSON.';
$msgContent = [];
foreach (array_slice($imgContent, 0, 5) as $ic) {
@ -317,6 +317,7 @@ try {
'OK' => true,
'mode' => 'extract_page',
'menuName' => $menuName,
'menuSchedule' => $menuData['menuSchedule'] ?? '',
'url' => $singleUrl,
'DATA' => [
'business' => $menuData['business'] ?? [],