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 <noreply@anthropic.com>
This commit is contained in:
parent
a181c1b90a
commit
bc1f8d4f4b
1 changed files with 10 additions and 5 deletions
|
|
@ -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 => {
|
||||
|
|
|
|||
Reference in a new issue