fix
This commit is contained in:
@@ -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:")
|
||||
|
||||
Reference in New Issue
Block a user