69 lines
1.8 KiB
Go
69 lines
1.8 KiB
Go
|
|
package app
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"encoding/json"
|
|||
|
|
"fmt"
|
|||
|
|
"strings"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
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"]
|
|||
|
|
}`)
|
|||
|
|
|
|||
|
|
const questionDistillPromptVersion = "question_distill_v1"
|
|||
|
|
|
|||
|
|
func buildQuestionDistillPrompt(brandName string, competitorNames []string, seedTopic string) string {
|
|||
|
|
competitors := "无"
|
|||
|
|
if len(competitorNames) > 0 {
|
|||
|
|
encoded, _ := json.Marshal(competitorNames)
|
|||
|
|
competitors = string(encoded)
|
|||
|
|
}
|
|||
|
|
return fmt.Sprintf(`你是一个 GEO(Generative Engine Optimization)资深策略师。
|
|||
|
|
请围绕当前品牌和输入主题,生成中国用户在 AI 搜索里真实会问的问题。
|
|||
|
|
|
|||
|
|
【输入】
|
|||
|
|
- 当前品牌: %s
|
|||
|
|
- 竞品列表: %s
|
|||
|
|
- 主题: %s
|
|||
|
|
|
|||
|
|
【约束】
|
|||
|
|
1. candidates 长度不超过 20。
|
|||
|
|
2. 问题必须是自然口语问句,避免口号、短词和营销文案。
|
|||
|
|
3. 尽量覆盖 informational、evaluative、decisional 三类意图。
|
|||
|
|
4. 至少 4 条包含地域、价位、人群或场景修饰。
|
|||
|
|
5. 每条问题尽量不超过 40 个中文字符。
|
|||
|
|
6. 严格按响应格式输出,不要解释。`,
|
|||
|
|
strings.TrimSpace(brandName),
|
|||
|
|
competitors,
|
|||
|
|
strings.TrimSpace(seedTopic),
|
|||
|
|
)
|
|||
|
|
}
|