Simplify: categories as strings, subcategory on items

This commit is contained in:
John Mizerek 2026-02-12 19:37:04 -08:00
parent dfb264eba6
commit 3e9f07df1a

View file

@ -256,7 +256,7 @@
<cfset arrayAppend(response.steps, "Found " & arrayLen(h3Texts) & " h3 tags in HTML")>
<!--- System prompt for URL analysis --->
<cfset systemPrompt = "You are an expert at extracting structured menu data from restaurant website HTML. Extract ALL menu data visible in the HTML. Return valid JSON with these keys: business (object with name, address, phone, hours, brandColor), categories (array of category objects - each with name and optional subcategories array), modifiers (array of modifier templates with name, required boolean, appliesTo, categoryName if applicable, and options array), items (array with name, description, price, category, subcategory if applicable, modifiers array, and imageUrl if found). CRITICAL: Extract EVERY menu item visible in the HTML - do not skip any items. For categories: Look for h3 headers inside menu sections - these are subcategories. Group them under parent categories. Format: [{""name"":""Beverages"",""subcategories"":[{""name"":""Beer""},{""name"":""Wine""}]},{""name"":""Food""}]. For imageUrl: return the highest quality image URL for each item (prefer srcset largest size, or src if no srcset). For brandColor: suggest a vibrant hex color (6 digits, no hash symbol) based on the restaurant style. For hours: format as ""Mon-Fri 10:30am-10pm, Sat 11am-10pm, Sun 11am-9pm"". Include ALL days visible. For prices: extract as numbers (e.g., 12.99). For modifier options: use format {""name"": ""option"", ""price"": 0}. Return ONLY valid JSON, no markdown, no explanation.">
<cfset systemPrompt = "You are an expert at extracting structured menu data from restaurant website HTML. Extract ALL menu data visible in the HTML. Return valid JSON with these keys: business (object with name, address, phone, hours, brandColor), categories (array of category names), modifiers (array of modifier templates with name, required boolean, appliesTo, categoryName if applicable, and options array), items (array with name, description, price, category, subcategory, modifiers array, and imageUrl if found). CRITICAL: Extract EVERY menu item visible in the HTML - do not skip any items. For items: if there is a subsection header (like an h3) above the item within its category section, include that as subcategory. For brandColor: suggest a vibrant hex color (6 digits, no hash symbol) based on the restaurant style. For hours: format as ""Mon-Fri 10:30am-10pm, Sat 11am-10pm, Sun 11am-9pm"". Include ALL days visible. For prices: extract as numbers (e.g., 12.99). For modifier options: use format {""name"": ""option"", ""price"": 0}. Return ONLY valid JSON, no markdown, no explanation.">
<!--- Build message content --->
<cfset messagesContent = arrayNew(1)>