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
+13 -3
View File
@@ -11,6 +11,19 @@ func resolveProductPromptTemplates(in ProductInput) (systemTpl, userTpl string)
systemTpl = strings.TrimSpace(in.EnhanceSystemTemplate)
userTpl = strings.TrimSpace(in.EnhanceUserTemplate)
catPrompt := strings.TrimSpace(in.CategoryEnhancePrompt)
descTpl := aiprompts.EffectiveDescriptionTemplateAny(in.DescriptionTemplate, catPrompt)
// Legacy A1 path: category Prompt WAS the user message (GPT predloga with
// <name>/<metaDescription>/HTML). When formulas are set, rebuild that shape
// instead of burying instructions under the generic retail copywriter overlay.
if categoryUsesA1StyleFormula(catPrompt, in.TitleTemplate, descTpl) {
userTpl = buildA1StyleEnhanceUserTemplate(catPrompt, in.TitleTemplate, descTpl, in.OmitSEOMeta)
systemTpl = a1StyleEnhanceSystemTemplate
allowed := enhanceAllowedAttrKeys(in, in.CategoryUniqueID)
userTpl = AppendAttributeConstraints(userTpl, allowed, in.TitleTemplate)
return systemTpl, userTpl
}
// Per-category prompt wins for the user message (company system keeps JSON schema / brand).
if catPrompt != "" {
userTpl = ensureCategoryEnhanceUserContext(catPrompt)
@@ -24,9 +37,6 @@ func resolveProductPromptTemplates(in ProductInput) (systemTpl, userTpl string)
userTpl = def.UserTemplate
}
}
// Prefer stored description_template; else derive HTML sections from the
// category prompt Description role (A1-style <H2>{…}</H2> overlays).
descTpl := aiprompts.EffectiveDescriptionTemplateAny(in.DescriptionTemplate, catPrompt)
// Category formulas are language-agnostic; inject once into the shared user skeleton.
userTpl = AppendFormulaConstraints(userTpl, in.TitleTemplate, descTpl, in.OmitSEOMeta)
// Free-form --- Title --- instructions when structured title_template is empty.