From bc1f8d4f4b4f97e8f69816bd074d761531552e61 Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Sat, 14 Mar 2026 17:35:01 -0700 Subject: [PATCH] Use discovered business info in multi-page extract flow - Store businessInfo from discovery phase - Pre-populate from JSON-LD/meta before sub-page extraction - Only fill gaps from sub-page Claude responses Co-Authored-By: Claude Opus 4.6 --- portal/setup-wizard.html | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/portal/setup-wizard.html b/portal/setup-wizard.html index 7108f13..fab340a 100644 --- a/portal/setup-wizard.html +++ b/portal/setup-wizard.html @@ -1428,6 +1428,9 @@ const menuPages = discoverResult.menuPages || []; const siteName = discoverResult.siteName || ''; + // Store business info from discovery (JSON-LD, meta tags, etc.) + config.discoveredBusinessInfo = discoverResult.businessInfo || {}; + if (menuPages.length > 1) { // Multiple menus found — show confirmation step const pageListHtml = menuPages.map((p, i) => ` @@ -1496,11 +1499,11 @@ document.getElementById('conversation').innerHTML = ''; - // Combined results + // Combined results — start with business info from discovery phase const allItems = []; const allCategories = []; const allMenus = []; - let businessInfo = {}; + let businessInfo = { ...(config.discoveredBusinessInfo || {}) }; let totalProcessed = 0; for (const page of pages) { @@ -1521,9 +1524,11 @@ if (result.OK && result.DATA) { const data = result.DATA; - // Merge business info (first non-empty wins) - if (data.business && Object.keys(data.business).length > Object.keys(businessInfo).length) { - businessInfo = { ...businessInfo, ...data.business }; + // Merge business info — fill gaps from sub-page extractions + if (data.business) { + for (const [k, v] of Object.entries(data.business)) { + if (v && !businessInfo[k]) businessInfo[k] = v; + } } // Add categories with menu tag (data.categories || []).forEach(cat => {