Files
geo/server/internal/tenant/app/question_distill_prompt.go
T
root 34ef5873ca
Deployment Config CI / Deployment Config (push) Successful in 27s
Backend CI / Backend (push) Successful in 16m5s
feat: load question expansion prompts from yaml
2026-05-13 20:24:51 +08:00

54 lines
1.2 KiB
Go

package app
import (
"encoding/json"
"strings"
"github.com/geo-platform/tenant-api/internal/tenant/prompts"
)
var questionDistillSchema = []byte(`{
"type": "object",
"additionalProperties": false,
"properties": {
"candidates": {
"type": "array",
"maxItems": 20,
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"text": {
"type": "string",
"minLength": 4,
"maxLength": 80
},
"intent": {
"type": "string",
"enum": ["informational", "evaluative", "decisional"]
},
"layer": {
"type": "string",
"enum": ["L1", "L2", "L3", "L4", "L5"]
}
},
"required": ["text", "intent", "layer"]
}
}
},
"required": ["candidates"]
}`)
func buildQuestionDistillPrompt(brandName string, competitorNames []string, seedTopic string) string {
competitors := "无"
if len(competitorNames) > 0 {
encoded, _ := json.Marshal(competitorNames)
competitors = string(encoded)
}
return prompts.QuestionDistillPrompt(
strings.TrimSpace(brandName),
competitors,
strings.TrimSpace(seedTopic),
)
}