This commit is contained in:
greeneclipse committed 2026-10-14 19:23:16 +02:00
1 parent ff6c2df618
commit 43cfaa0411
18 files changed
+683 -299

No files matched your search

@@ -23,7 +23,7 @@ Rules:
- Schema: {"name":"string","description":"string","meta_title":"string","meta_description":"string","attrs":{}}
- Obey the GPT predloga in the user message step by step
- "name" follows the <name> Title formula — never copy Staro_ime_izdelka unchanged when the formula asks for a new name
- "description" is ONE HTML string covering each GPT predloga body section in order (tags matching type: h1/h2/h3/h4, p, ul) — do NOT wrap the reply in <name> or <metaDescription> tags
- "description" is ONE HTML string covering required GPT predloga body sections in order; skip optional sections if unsupported (tags matching type: h1/h2/h3/h4, p, ul) — do NOT wrap the reply in <name> or <metaDescription> tags
- "meta_title" and "meta_description" are plain SEO text from the meta / <metaDescription> formula (never HTML body)
- attrs: only Allowed attribute keys when listed; fill from evidence only; omit unknowns
{{brand_voice}}`
@@ -36,7 +36,7 @@ Rules:
- Schema: {"name":"string","description":"string","meta_title":"string","meta_description":"string","attrs":{}}
- Obey the product template in the user message step by step
- "name" follows the <name> formula — never copy Old_product_name unchanged when the formula asks for a new name
- "description" is ONE HTML string covering each product template body section in order (tags matching type: h1/h2/h3/h4, p, ul) — do NOT wrap the reply in <name> or <metaDescription> tags
- "description" is ONE HTML string covering required template sections in order; skip optional sections if unsupported (tags matching type: h1/h2/h3/h4, p, ul) — do NOT wrap the reply in <name> or <metaDescription> tags
- "meta_title" and "meta_description" are plain SEO text from the meta / <metaDescription> formula (never HTML body)
- Use only the supplied Old_product_name, Old_product_description, Category and Attrs as facts; never invent specifications
- attrs: only Allowed attribute keys when listed; fill from evidence only; omit unknowns
@@ -112,10 +112,10 @@ func buildA1StyleEnhanceUserTemplate(catPrompt string, titleTemplate, descriptio
var predloga strings.Builder
if titleInstr != "" {
fmt.Fprintf(&predloga, "<name>{%s}</name>\n", collapseLegacyInstr(titleInstr))
fmt.Fprintf(&predloga, "<name>{%s}</name>\n", unwrapCategoryInstruction(titleInstr))
}
if !omitSEOMeta && metaInstr != "" {
fmt.Fprintf(&predloga, "<metaDescription>{%s}</metaDescription>\n", collapseLegacyInstr(metaInstr))
fmt.Fprintf(&predloga, "<metaDescription>{%s}</metaDescription>\n", unwrapCategoryInstruction(metaInstr))
}
if descBody != "" {
predloga.WriteString(strings.TrimSpace(descBody))
@@ -216,6 +216,14 @@ var a1StyleLabelsEN = a1StyleLabels{
// by {{language}} in the system prompt either way.
var reSlovenianFormulaCue = regexp.MustCompile(`(?i)novo[ _]ime[ _]izdelka|napiši|napisi|izpostavi|izdelka|znamka`)
func unwrapCategoryInstruction(s string) string {
s = collapseLegacyInstr(s)
if strings.HasPrefix(s, "{") && strings.HasSuffix(s, "}") && !strings.HasPrefix(s, "{{") {
return strings.TrimSpace(s[1 : len(s)-1])
}
return s
}
func collapseLegacyInstr(s string) string {
s = strings.TrimSpace(s)
s = strings.ReplaceAll(s, "\r\n", "\n")
@@ -243,7 +251,7 @@ func FormatDescriptionFormulaAsLegacyHTML(template any) string {
case "h1", "h2", "h3", "h4":
fmt.Fprintf(&b, "<%s>{%s}</%s>", strings.ToUpper(typ), instr, strings.ToUpper(typ))
case "ul", "ol", "li":
fmt.Fprintf(&b, "<b>{Tehnične specifikacije}</b><ul><li>{%s}</li></ul>", instr)
fmt.Fprintf(&b, "<ul><li>{%s}</li></ul>", instr)
case "p", "":
fmt.Fprintf(&b, "<p>{%s}</p>", instr)
default: