This commit is contained in:
2026-08-23 13:39:56 +02:00
parent 89ae7e5fa8
commit 815e26d359
7 changed files with 283 additions and 8 deletions
@@ -24,18 +24,23 @@ 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, in.DescriptionTemplate, in.OmitSEOMeta)
userTpl = AppendFormulaConstraints(userTpl, in.TitleTemplate, descTpl, in.OmitSEOMeta)
// Category attribute allowlist + title-formula keys guide JSON "attrs" extraction.
allowed := enhanceAllowedAttrKeys(in, in.CategoryUniqueID)
userTpl = AppendAttributeConstraints(userTpl, allowed, in.TitleTemplate)
// Company/built-in system prompts often say "1-2 sentences"; when a category
// description formula exists, override that so process matches A1 category defs.
systemTpl = AppendDescriptionFormulaSystemOverride(systemTpl, in.DescriptionTemplate)
systemTpl = AppendDescriptionFormulaSystemOverride(systemTpl, descTpl)
// Same for title_template vs "short retail title" — formulas win for name structure.
systemTpl = AppendTitleFormulaSystemOverride(systemTpl, in.TitleTemplate)
// Free-form Title section (prompt UI) that asks for a rewrite — not title_template.
systemTpl = AppendTitlePromptRewriteOverride(systemTpl, catPrompt)
if !in.OmitSEOMeta {
systemTpl = AppendMetaFormulaSystemOverride(systemTpl, in.DescriptionTemplate)
systemTpl = AppendMetaFormulaSystemOverride(systemTpl, descTpl)
}
// categories.prompt applies to name, description, and attrs (not description-only).
systemTpl = AppendCategoryEnhanceSystemOverlay(systemTpl, catPrompt)