This commit is contained in:
2026-08-16 23:42:00 +02:00
parent 6e77154228
commit 92f046b542
32 changed files with 1443 additions and 105 deletions
+13 -1
View File
@@ -663,7 +663,19 @@ func (h HeuristicCompleter) Complete(_ context.Context, system, user string) (Co
if desc == "" || descriptionEchoesTitle(desc, name) || isWeakPriorEnhanceDescription(desc, name) {
desc = inventHeuristicDescription(system, user, name)
}
b, _ := json.Marshal(map[string]string{"name": name, "description": desc})
payload := map[string]any{"name": name, "description": desc}
if strings.Contains(systemL, "meta_title") {
payload["meta_title"] = truncateRunes(name, 60)
payload["meta_description"] = truncateRunes(stripMetaTags(desc), 155)
}
if strings.Contains(systemL, `"attrs"`) {
if attrs := CompactAttrs(parseAttrsFromPrompt(user), MaxAttrKeys); len(attrs) > 0 {
payload["attrs"] = attrs
} else {
payload["attrs"] = map[string]any{}
}
}
b, _ := json.Marshal(payload)
text = string(b)
case strings.Contains(systemL, "attributes") && strings.Contains(systemL, "json"):
text = `{"material":"unknown","brand":"unknown"}`