Fix
This commit is contained in:
1 parent
eefb7e2b75
commit
41f1a7dbe4
2 files changed
+58
-2
No files matched your search
@@ -0,0 +1,38 @@
|
||||
package processing
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAppendDescriptionRichnessOverrideIsIdempotent(t *testing.T) {
|
||||
once := AppendDescriptionRichnessOverride("base system")
|
||||
if !strings.HasPrefix(once, "base system\n") || !strings.Contains(once, "Description depth (platform rule") {
|
||||
t.Fatalf("override not appended: %q", once)
|
||||
}
|
||||
if twice := AppendDescriptionRichnessOverride(once); twice != once {
|
||||
t.Fatal("override appended twice")
|
||||
}
|
||||
if AppendDescriptionRichnessOverride("") != descriptionRichnessOverride {
|
||||
t.Fatal("empty system should become the override alone")
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveProductPromptTemplatesAddsRichnessOverride(t *testing.T) {
|
||||
cases := map[string]ProductInput{
|
||||
"category prompt": {
|
||||
CategoryEnhancePrompt: "Opis: {{description}} {{attrs}}",
|
||||
CategoryUniqueID: "televizorji",
|
||||
},
|
||||
"no prompt": {},
|
||||
}
|
||||
for name, in := range cases {
|
||||
sys, _ := resolveProductPromptTemplates(in)
|
||||
if !strings.Contains(sys, "Description depth (platform rule") {
|
||||
t.Errorf("%s: system prompt lacks richness override", name)
|
||||
}
|
||||
if !strings.Contains(sys, "never") && !strings.Contains(sys, "Do not invent") {
|
||||
t.Errorf("%s: override must keep the no-invention rule", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user