Restore working prompt, add subcategory support without breaking item extraction
This commit is contained in:
parent
d8dacb198e
commit
ec59f05814
1 changed files with 1 additions and 23 deletions
|
|
@ -256,29 +256,7 @@
|
|||
<cfset arrayAppend(response.steps, "Found " & arrayLen(h3Texts) & " h3 tags in HTML")>
|
||||
|
||||
<!--- System prompt for URL analysis --->
|
||||
<cfset systemPrompt = "Extract menu data from restaurant website HTML. Return JSON with: business, categories, modifiers, items.
|
||||
|
||||
##1 CATEGORIES - MOST IMPORTANT##
|
||||
Search the HTML for EVERY <h3> tag. Each h3 text is a SUBCATEGORY name. Group them under parent categories.
|
||||
Toast POS structure:
|
||||
- Parent categories: top nav links or dropdown items (Beverages, Food, Merchandise)
|
||||
- Subcategories: ALL h3 tags inside div.menuGroup or section.menuSection (e.g., 'Beer, Cider & Kombucha', 'White Wine', 'Red Wine', 'Cocktails', 'Sandwiches', 'Salads')
|
||||
REQUIRED: Find and list EVERY h3 in the HTML. Output format:
|
||||
{""categories"":[{""name"":""Beverages"",""subcategories"":[{""name"":""Beer, Cider & Kombucha""},{""name"":""White Wine""},{""name"":""Red Wine""}]},{""name"":""Food"",""subcategories"":[{""name"":""Sandwiches""},{""name"":""Salads""}]}]}
|
||||
|
||||
##2 ITEMS##
|
||||
Extract from li.item elements. Include: name, description, price (number), category (parent), subcategory (from nearest h3 above).
|
||||
|
||||
##3 IMAGES##
|
||||
For each item, extract ALL image URLs as object: {""src"":""url"",""srcset"":""urls"",""small"":""url"",""medium"":""url"",""large"":""url""}. Parse srcset attribute for multiple sizes.
|
||||
|
||||
##4 BUSINESS##
|
||||
name, address, phone, hours (format: ""Mon-Fri 10am-9pm, Sat-Sun 11am-8pm""), brandColor (6-digit hex without hash symbol).
|
||||
|
||||
##5 MODIFIERS##
|
||||
name, required (boolean), appliesTo, options array [{""name"":""opt"",""price"":0}].
|
||||
|
||||
Return ONLY valid JSON.">
|
||||
<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 images object with all image URLs 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 images: Extract ALL image URLs for each item as an object with keys like src, srcset, small, medium, large. Parse srcset attributes. 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)>
|
||||
|
|
|
|||
Reference in a new issue