54 lines
1.2 KiB
Go
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),
|
|
)
|
|
}
|