Image data overwrites HTML-extracted data (more reliable)

This commit is contained in:
John Mizerek 2026-02-13 10:53:48 -08:00
parent 1432d8e2b8
commit abf6965614

View file

@ -589,15 +589,13 @@
<cftry>
<cfset imgBizData = deserializeJSON(imgText)>
<!--- Merge into toastBusiness (only fill in missing fields) --->
<!--- Image data OVERWRITES HTML-extracted data (more reliable) --->
<cfset bizFieldsToCheck = "name,addressLine1,city,state,zip,phone,hours,brandColor">
<cfloop list="#bizFieldsToCheck#" index="bizField">
<cfif structKeyExists(imgBizData, bizField) AND isSimpleValue(imgBizData[bizField]) AND len(trim(imgBizData[bizField]))>
<cfif NOT structKeyExists(toastBusiness, bizField) OR NOT len(toastBusiness[bizField])>
<cfset toastBusiness[bizField] = trim(imgBizData[bizField])>
<cfset arrayAppend(response.steps, "Found " & bizField & " from image: " & left(toastBusiness[bizField], 50))>
</cfif>
</cfif>
</cfloop>
<cfcatch>
<cfset arrayAppend(response.steps, "Could not parse image analysis JSON")>