diff --git a/apps/api/cmd/seed-a1/category_prompts.go b/apps/api/cmd/seed-a1/category_prompts.go index f241827..dc625fe 100644 --- a/apps/api/cmd/seed-a1/category_prompts.go +++ b/apps/api/cmd/seed-a1/category_prompts.go @@ -148,9 +148,10 @@ func applyCategoryPrompts(ctx context.Context, pg *pgxpool.Pool, companyID uuid. byNorm := make(map[string]string, len(file.Entries)) byUnique := make(map[string]string, len(file.Entries)) - // Overlay sets the shared JSON-compatible enhance user template (not legacy HTML). + // Overlay sets the shared role-sectioned enhance user template + // (aiprompts.CategoryEnhanceUserTemplate — title/description/meta/attributes). // Seed JSON selects which categories get a prompt (prefer unique_id, else name). - // Unique title/description formulas stay in title_template / description_template. + // Unique title/description/meta formulas stay in title_template / description_template. // Stored under "sl" + "*" so prompt->>'sl' and LangPromptAny both resolve; // language stays via {{language}}. canonical := prepareCategoryPrompt(aiprompts.CategoryEnhanceUserTemplate) diff --git a/apps/api/internal/aiprompts/kinds.go b/apps/api/internal/aiprompts/kinds.go index 92d2980..bdae133 100644 --- a/apps/api/internal/aiprompts/kinds.go +++ b/apps/api/internal/aiprompts/kinds.go @@ -26,7 +26,9 @@ type Variable struct { // Catalog of supported {{variables}} (only these are substituted; unknown tokens stay literal). var VariableCatalog = []Variable{ {Name: "name", Label: "Product name", Description: "Current product title", Keys: []string{KeyProductEnhance, KeySEOMeta}}, - {Name: "description", Label: "Description", Description: "Current product description", Keys: []string{KeyProductEnhance, KeySEOMeta}}, + // description = product HTML body input (not SEO meta_description). Template key + // stays "description" so stored tenant prompts keep working (renaming would be BREAKING). + {Name: "description", Label: "Product description", Description: "Current product description (HTML body). Not SEO meta_description.", Keys: []string{KeyProductEnhance, KeySEOMeta}}, {Name: "category", Label: "Category", Description: "Resolved category name", Keys: []string{KeyProductEnhance, KeySEOMeta}}, {Name: "attrs", Label: "Attributes", Description: "Compact JSON of product attributes", Keys: []string{KeyProductEnhance}}, {Name: "gtin", Label: "GTIN", Description: "Product GTIN / barcode when present", Keys: []string{KeyProductEnhance}}, @@ -48,20 +50,38 @@ type DefaultTemplate struct { } // CategoryEnhanceUserTemplate is the shared per-category (and built-in) enhance USER -// message. Includes {{name}} {{description}} {{attrs}} {{category}} {{language}}. -// Compatible with the enhance system JSON schema {"name","description"} — not a -// competing HTML marketing document. Title/description formulas stay in -// title_template / description_template and are appended at render time as plain -// text instructions (see processing.AppendFormulaConstraints). -// Used by local A1/Demo prompt repair and seed-a1 overlays. -const CategoryEnhanceUserTemplate = `Your reply is parsed as JSON {"name":"string","description":"string"} only (system schema). Write name and description in {{language}} (do not hardcode a language). -- name: short retail title; follow any Title formula constraints that follow; use Attrs -- description: when a Description formula follows, emit ONE HTML string covering each section in order (tags matching type: h1/h2/h3/h4, p, ul); otherwise prefer 1-3 factual paragraphs as ONE string with limited HTML (