Files
geo/server/internal/tenant/prompts/template_seeds.go
T
root 1eae6fb6d4
Deployment Config CI / Deployment Config (push) Successful in 29s
Frontend CI / Frontend (push) Successful in 4m4s
Backend CI / Backend (push) Failing after 7m12s
feat(questions): make brand questions the primary monitoring & template axis
- add /questions/combination-fill endpoint with AI-driven, IP-region-aware matrix fill
- extract ip2region resolver from ops/app into shared/ipregion for cross-service use
- thread question_id filter through dashboard composite, citation summary, and collect-now
- switch template wizard from keyword inputs to brand-question selection (primary + supplemental)
- pass brand_question and supplemental_questions through assist/title/outline prompts
- add AiWaitingModal + 45s client timeout and request_timeout error mapping for long AI flows

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 15:59:39 +08:00

383 lines
15 KiB
Go

package prompts
type PlatformTemplateSeed struct {
Key string
Name string
PromptTemplate string
CardConfigJSON string
}
func PlatformTemplateSeeds() []PlatformTemplateSeed {
seeds := append([]PlatformTemplateSeed(nil), platformTemplateSeeds...)
for i := range seeds {
promptTemplate, cardConfigJSON := ApplyPlatformTemplatePromptOverrides(
seeds[i].Key,
stringPointer(seeds[i].PromptTemplate),
[]byte(seeds[i].CardConfigJSON),
)
if promptTemplate != nil {
seeds[i].PromptTemplate = *promptTemplate
} else {
seeds[i].PromptTemplate = ""
}
seeds[i].CardConfigJSON = string(cardConfigJSON)
}
return seeds
}
func stringPointer(value string) *string {
if value == "" {
return nil
}
return &value
}
var platformTemplateSeeds = []PlatformTemplateSeed{
{
Key: "top_x_article",
Name: "Top X 文章",
PromptTemplate: "",
CardConfigJSON: `{
"hero": {
"accent": "Top X",
"helper": "排序推荐类文章,适合快节奏种草、结构化比较和选购决策。"
},
"wizard": {
"steps": {
"basic": { "title": "基本信息", "description": "品牌、品牌问题与竞品上下文" },
"structure": { "title": "文章结构", "description": "标题方案、结构组合与重点补充" },
"generate": { "title": "生成文章", "description": "确认参数并进入生成队列" }
},
"basic": {
"analyze_button_label": "分析",
"cards": {
"brand": {
"title": "品牌信息",
"hint": "品牌可手动输入,也可从品牌库带入。AI 会结合品牌、官网和品牌问题补齐摘要与竞品。"
},
"keywords": {
"title": "品牌问题",
"hint": "品牌主问题必选且只能选一个;补充覆盖问题可选,最多 3 个,只进入文章主体和结尾点题。"
},
"template_fields": {
"title": "模板字段",
"hint": "保留本模板特有的补充字段,用来约束选题角度与文章范围。"
},
"competitors": {
"title": "竞品列表",
"hint": "竞品可编辑、追加和收藏到品牌词库。后续标题生成会严格基于当前竞品上下文。"
}
}
},
"structure": {
"cards": {
"choose_title": {
"title": "选择文章标题",
"hint": "AI 会结合品牌主问题和竞品上下文给出 5 个更适合的标题候选,你可以直接选择或改写。"
},
"outline": {
"title": "文章结构",
"hint": "保留推荐文章的默认结构,也可以按这次出稿需求删减、补充自定义段落。"
},
"preview": {
"title": "文章预览",
"hint": "右侧会根据当前标题和结构实时预览最终文章框架。"
}
}
},
"review": {
"card": {
"title": "提交前确认",
"hint": "确认当前标题、结构和品牌上下文无误后再提交生成任务。"
},
"alert_message": "后端会立即创建文章与任务记录,再由排队 worker 异步完成正文生成。"
},
"managed_fields": ["topic", "count"],
"derived_inputs": {
"topic": { "source": "primary_keyword_or_brand" },
"count": { "source": "competitor_count", "fallback_number": 5 }
},
"analyze_prompt_template": "",
"title_prompt_template": "",
"outline_prompt_template": "",
"outline": {
"allow_custom": true,
"custom_placeholder": "补充一个额外结构,例如\"选购建议\"",
"preview_title": "文章预览",
"preview_caption": "预览会根据已选标题和结构实时更新。",
"sections": [
{ "key": "intro", "label": "引言", "default": true },
{ "key": "site_list", "label": "网站列表", "default": true },
{ "key": "key_points", "label": "文章关键要点", "default": true },
{ "key": "what_is_question", "label_template": "围绕{{brand_question}}展开", "default": false },
{ "key": "features", "label": "特点", "default": false },
{ "key": "pros_cons", "label": "优缺点", "default": false },
{ "key": "audience", "label": "适合人群", "default": false },
{ "key": "pricing", "label": "价格", "default": false },
{ "key": "how_to_choose", "label": "如何选择", "default": false },
{ "key": "conclusion", "label": "结论", "default": false }
]
}
}
}`,
},
{
Key: "product_review",
Name: "产品评测文章",
PromptTemplate: "",
CardConfigJSON: `{
"hero": {
"accent": "Review",
"helper": "产品评测类文章,适合做能力拆解、优缺点判断和适配建议。"
},
"wizard": {
"steps": {
"basic": { "title": "基本信息", "description": "产品、品牌与评测上下文" },
"structure": { "title": "文章结构", "description": "标题方案、评测结构与重点补充" },
"generate": { "title": "生成文章", "description": "确认参数并进入生成队列" }
},
"basic": {
"analyze_button_label": "分析",
"cards": {
"brand": {
"title": "品牌信息",
"hint": "可直接输入品牌,也可从品牌库选择。AI 会结合品牌问题补充适合评测文章的品牌背景。"
},
"keywords": {
"title": "品牌问题",
"hint": "品牌主问题控制标题和主线;补充覆盖问题只进入文章主体与结尾点题。"
},
"competitors": {
"visible": false
}
}
},
"structure": {
"cards": {
"choose_title": {
"title": "选择文章标题",
"hint": "AI 会生成 5 个更适合评测文章的标题候选,你可以挑选或覆盖。"
},
"outline": {
"title": "文章结构",
"hint": "保留评测默认结构,也可按具体产品情况增删段落。"
},
"preview": {
"title": "文章预览",
"hint": "右侧会根据标题和结构实时预览评测文章框架。"
}
},
"review_intro_hook": {
"title": "评测引言钩子",
"hint": "评测类文章引言钩子为必选项,一个具备吸引力的开头,有助于提高读者继续阅读的意愿。",
"field_name": "review_intro_hook",
"required": true,
"options": [
{ "key": "question", "label": "提出问题", "description": "用一个有趣的问题引导读者继续往下看", "default": true },
{ "key": "fact", "label": "分享事实", "description": "利用令人惊讶的事实或数据先抓住注意力" },
{ "key": "quote", "label": "引用名言", "description": "用一句贴切的名言或行业观点作为开头" },
{ "key": "story", "label": "讲述故事", "description": "从一个具体场景或小故事切入评测主题" },
{ "key": "feeling", "label": "分享感受", "description": "用第一视角的真实感受建立代入感" }
]
},
"outline_prompt_template": ""
},
"review": {
"card": {
"title": "提交前确认",
"hint": "确认当前标题、结构与评测角度后再提交生成。"
},
"alert_message": "后端会立即创建文章与任务记录,再由排队 worker 异步完成正文生成。"
},
"managed_fields": [],
"analyze_prompt_template": "",
"title_prompt_template": "",
"outline": {
"allow_custom": true,
"custom_placeholder": "补充一个额外结构,例如\"购买建议\"",
"preview_title": "文章预览",
"preview_caption": "预览会根据已选标题和结构实时更新。",
"sections": [
{ "key": "intro", "label": "引言", "default": true },
{ "key": "overview", "label": "产品概览", "default": true },
{ "key": "core_features", "label": "核心卖点", "default": true },
{ "key": "real_experience", "label": "使用体验", "default": false },
{ "key": "pros_cons", "label": "优缺点", "default": false },
{ "key": "audience", "label": "适合人群", "default": false },
{ "key": "buying_advice", "label": "购买建议", "default": false },
{ "key": "conclusion", "label": "结论", "default": false }
]
}
}
}`,
},
{
Key: "research_report",
Name: "研究报告文章",
PromptTemplate: "",
CardConfigJSON: `{
"hero": {
"accent": "Report",
"helper": "研究报告类文章,适合趋势解读、市场分析和策略判断。"
},
"wizard": {
"steps": {
"basic": { "title": "基本信息", "description": "品牌与品牌问题背景信息" },
"structure": { "title": "文章结构", "description": "标题方案、研究结构与重点补充" },
"generate": { "title": "生成文章", "description": "确认参数并进入生成队列" }
},
"basic": {
"analyze_button_label": "分析",
"cards": {
"brand": {
"title": "品牌信息",
"hint": "如研究对象与品牌有关,可补充品牌与官网信息帮助 AI 建立上下文。"
},
"keywords": {
"title": "品牌问题",
"hint": "品牌主问题控制报告核心视角;补充覆盖问题只进入主体覆盖和结尾点题。"
},
"competitors": {
"visible": false
}
}
},
"structure": {
"cards": {
"choose_title": {
"title": "选择文章标题",
"hint": "AI 会生成 5 个更适合研究型内容的标题候选,你可以直接选择或改写。"
},
"outline": {
"title": "文章结构",
"hint": "保留研究报告的默认结构,也可补充更贴近本次出稿的章节。"
},
"preview": {
"title": "文章预览",
"hint": "右侧会根据标题和结构实时预览报告框架。"
}
}
},
"review": {
"card": {
"title": "提交前确认",
"hint": "确认当前标题、结构和研究主题后再提交生成。"
},
"alert_message": "后端会立即创建文章与任务记录,再由排队 worker 异步完成正文生成。"
},
"managed_fields": [],
"derived_inputs": {
"subject": { "source": "primary_keyword_or_brand" }
},
"analyze_prompt_template": "",
"title_prompt_template": "",
"outline_prompt_template": "",
"outline": {
"allow_custom": true,
"custom_placeholder": "自定义输入,不超过10个字",
"custom_max_length": 10,
"preview_title": "文章预览",
"preview_caption": "预览会根据已选标题和结构实时更新。",
"sections": [
{ "key": "summary", "label": "摘要", "default": true },
{ "key": "intro", "label": "引言", "default": true },
{ "key": "methodology", "label": "研究方法与数据来源", "default": true },
{ "key": "segment_overview", "label": "细分市场概述", "default": true },
{ "key": "positioning_analysis", "label": "产品定位与优缺点", "default": true },
{ "key": "user_research", "label": "用户调研", "default": false },
{ "key": "target_audience", "label": "目标人群", "default": false },
{ "key": "competitor_comparison", "label": "竞品对比", "default": false },
{ "key": "research_conclusion", "label": "研究结论", "default": false },
{ "key": "analysis_recommendations", "label": "分析建议", "default": false }
]
}
}
}`,
},
{
Key: "brand_search_expansion",
Name: "品牌词搜索扩写",
PromptTemplate: "",
CardConfigJSON: `{
"hero": {
"accent": "Brand SEO",
"helper": "品牌词搜索扩写,适合品牌介绍、搜索意图承接、问答和比较型内容。"
},
"wizard": {
"steps": {
"basic": { "title": "基本信息", "description": "品牌、品牌问题与搜索意图上下文" },
"structure": { "title": "文章结构", "description": "标题方案、结构组合与重点补充" },
"generate": { "title": "生成文章", "description": "确认参数并进入生成队列" }
},
"basic": {
"analyze_button_label": "分析",
"cards": {
"brand": {
"title": "品牌信息",
"hint": "品牌和官网会帮助 AI 理解搜索对象,也便于后续沉淀到品牌库。"
},
"keywords": {
"title": "品牌问题",
"hint": "品牌主问题参与标题与主线;补充覆盖问题只进入正文主体和结尾点题。"
},
"template_fields": {
"title": "模板字段",
"hint": "模板字段会补充品牌词与搜索意图的具体边界。"
},
"competitors": {
"title": "参考对象",
"hint": "可补充竞品或替代方案,帮助品牌词扩写内容更完整。"
}
}
},
"structure": {
"cards": {
"choose_title": {
"title": "选择文章标题",
"hint": "AI 会生成 5 个更适合品牌词搜索扩写的标题候选。"
},
"outline": {
"title": "文章结构",
"hint": "保留默认搜索意图结构,也可以按本次需求增删段落。"
},
"preview": {
"title": "文章预览",
"hint": "右侧会根据标题和结构实时预览内容框架。"
}
}
},
"review": {
"card": {
"title": "提交前确认",
"hint": "确认当前标题、结构与搜索上下文后再提交生成。"
},
"alert_message": "后端会立即创建文章与任务记录,再由排队 worker 异步完成正文生成。"
},
"managed_fields": ["brand", "keyword"],
"derived_inputs": {
"brand": { "source": "brand_name" },
"keyword": { "source": "primary_keyword" }
},
"analyze_prompt_template": "",
"title_prompt_template": "",
"outline_prompt_template": "",
"outline": {
"allow_custom": true,
"custom_placeholder": "补充一个额外结构,例如\"常见问题\"",
"preview_title": "文章预览",
"preview_caption": "预览会根据已选标题和结构实时更新。",
"sections": [
{ "key": "intro", "label": "引言", "default": true },
{ "key": "search_intent", "label": "搜索意图", "default": true },
{ "key": "brand_overview", "label_template": "什么是{{brand_name}}", "default": true },
{ "key": "core_points", "label": "核心要点", "default": false },
{ "key": "comparison", "label": "对比与替代方案", "default": false },
{ "key": "faq", "label": "常见问题", "default": false },
{ "key": "conclusion", "label": "结论", "default": false }
]
}
}
}`,
},
}