This commit is contained in:
2026-08-23 18:58:03 +02:00
parent a30b78c3b6
commit f61fe05e7a
9 changed files with 551 additions and 61 deletions
+16
View File
@@ -863,6 +863,22 @@ func (e *Engine) enhance(ctx context.Context, in ProductInput, category string,
ReasoningEffort: "low",
})
elapsed := time.Since(started)
if obj != nil {
applyLegacyEnhanceTagFallback(obj, comp.Text)
} else if err != nil && strings.TrimSpace(comp.Text) != "" {
// Legacy A1 models sometimes reply with HTML <name>/<metaDescription> instead of JSON.
if n, m, body, ok := ParseLegacyEnhanceHTML(comp.Text); ok && (n != "" || body != "") {
obj = map[string]any{
"name": n,
"description": body,
"meta_description": m,
}
if n != "" && m == "" {
obj["meta_title"] = n
}
err = nil
}
}
if err != nil {
// Network/provider failure vs parse failure after retry
name := preferredProductTitle(in.GTIN, in.Name, in.PriorProcessedName)