This commit is contained in:
2026-08-16 23:07:32 +02:00
parent 389608ea56
commit 6e77154228
14 changed files with 1189 additions and 21 deletions
+8 -2
View File
@@ -644,6 +644,14 @@ func (h HeuristicCompleter) Complete(_ context.Context, system, user string) (Co
user = SanitizeText(user)
text := "General"
switch {
case strings.Contains(systemL, "categoryid") || (strings.Contains(systemL, "categor") && strings.Contains(systemL, "available categories")):
// Taxonomy pick: return first Available Categories (ID: …) from the user prompt.
id := firstAvailableCategoryIDFromPrompt(user)
if id == "" {
id = "unknown"
}
b, _ := json.Marshal(map[string]any{"categoryId": id, "confidence": 0.5})
text = string(b)
case strings.Contains(systemL, `"name"`) || strings.Contains(systemL, "titles and descriptions"):
// Prefer explicit Name:/Desc: (ProductEnhanceUser) or Current name: labels.
// Never use firstLine(user) alone — that line is often "Category: …".
@@ -659,8 +667,6 @@ func (h HeuristicCompleter) Complete(_ context.Context, system, user string) (Co
text = string(b)
case strings.Contains(systemL, "attributes") && strings.Contains(systemL, "json"):
text = `{"material":"unknown","brand":"unknown"}`
case strings.Contains(systemL, "categor"):
text = "General"
default:
// Never echo ProductEnhanceUser's first line ("Category: …") as title/output.
text = labeledPromptValue(user, "name:", "current name:")