Files
geo/server/internal/tenant/app/kol_generation_payload_test.go
T
root 0bf4b73ebc feat(tenant): inject brand description context into every generation path
Include the current brand description in template, custom, imitation,
and KOL article-generation prompts while bounding prompt growth.

- Add a shared brand-context builder that resolves the current brand,
  compacts long descriptions, and caps rendered output at 2000 runes.
- Snapshot a structured brand prompt context on queued tasks so old
  jobs stay reproducible and retries stay stable.
- Route brand-profile facts through the existing typed fact guard so
  founding dates and year counts get the same pre-persistence validation
  as RAG facts, with brand facts outranking conflicting RAG facts.
- Fix the KOL creator to attach the brand scope its worker consumes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 20:21:59 +08:00

22 lines
576 B
Go

package app
import (
"reflect"
"testing"
)
func TestAttachKolGenerationKnowledgeScopeMatchesWorkerContract(t *testing.T) {
taskInput := map[string]any{
"rendered_prompt": "write an article",
}
attachKolGenerationKnowledgeScope(taskInput, 4, []int64{47, 17, 47, 0})
if got := int64(extractInt(taskInput, "brand_id")); got != 4 {
t.Fatalf("worker brand_id = %d, want 4", got)
}
if got := extractKnowledgeGroupIDs(taskInput["knowledge_group_ids"]); !reflect.DeepEqual(got, []int64{17, 47}) {
t.Fatalf("worker knowledge_group_ids = %#v, want [17 47]", got)
}
}