fix
This commit is contained in:
@@ -202,6 +202,22 @@ func TestPreferredProductTitle_skipsFormulaLeakage(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPreferredProductTitle_skipsBrandOnlyWhenFullNameExists(t *testing.T) {
|
||||
got := preferredProductTitle("1", "ANKER", "Anker Soundcore Space One Pro")
|
||||
if got != "Anker Soundcore Space One Pro" {
|
||||
t.Fatalf("got %q want full product name", got)
|
||||
}
|
||||
got = preferredProductTitle("1", "Anker", "Anker Soundcore Space One Pro Wireless")
|
||||
if got != "Anker Soundcore Space One Pro Wireless" {
|
||||
t.Fatalf("got %q", got)
|
||||
}
|
||||
// Brand alone when no longer candidate.
|
||||
got = preferredProductTitle("1", "ANKER")
|
||||
if got != "ANKER" {
|
||||
t.Fatalf("brand-only alone got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsPromptLabelTitle(t *testing.T) {
|
||||
cases := map[string]bool{
|
||||
"Category:": true,
|
||||
@@ -390,13 +406,13 @@ func TestHeuristicCompleter_keepsNameWhenFormulaConstraintsPresent(t *testing.T)
|
||||
h := HeuristicCompleter{}
|
||||
// Shape matches aiprompts.CategoryEnhanceUserTemplate: instruction "- name:"
|
||||
// appears BEFORE the real "Name:" field — labeledPromptValue must skip leakage.
|
||||
user := `Your reply is parsed as JSON {"name":"string","description":"string"} only (system schema). Write name and description in English (do not hardcode a language).
|
||||
user := `Your reply is parsed as JSON {"name":"string","description":"string","meta_title":"string","meta_description":"string"} only (system schema). Write all fields in English (do not hardcode a language).
|
||||
- name: short retail title; follow any Title formula constraints that follow; use Attrs
|
||||
- description: prefer 1-3 factual paragraphs as ONE string
|
||||
|
||||
Category: demo-electronics
|
||||
Name: Vox SWA-8000W
|
||||
Desc: Washer
|
||||
Description: Washer
|
||||
Attrs: {"brand":"Vox"}
|
||||
|
||||
Title formula (order matters; join with " "). Build name from Attrs using this structure:
|
||||
|
||||
Reference in New Issue
Block a user