feat(imitation): simplify form fields and make brand_name required
Deployment Config CI / Deployment Config (push) Successful in 25s
Frontend CI / Frontend (push) Successful in 2m51s
Backend CI / Backend (push) Successful in 14m47s

Remove industry, target_audience, content_goal, tone, and length_goal from the imitation form; brand_name is now mandatory with autocomplete from brand library, keywords are pre-populated from the selected brand's search keywords, and output length is hardcoded to ~2000 characters in the prompt.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-20 02:16:45 +08:00
parent c44ddc55a6
commit 00eb514efc
8 changed files with 67 additions and 124 deletions
+3 -6
View File
@@ -278,7 +278,8 @@ runtime:
- 文章结构不动,文章分析核心维度不动,只动目标达成词(也就是brand_name)
- 保留源文章中的事实信息、论证逻辑和可复用观点。
- 不要逐句同义替换,不要复制源文的独特措辞,不要编造源文、知识库和补充要求之外的事实。
- 如果给出了地域、品牌、目标读者或内容目标,标题和正文都要自然贴合这些上下文。
- 如果给出了地域、品牌/主体或优化关键词,标题和正文都要自然贴合这些上下文。
- 全文篇幅控制在 2000 字左右。
%s
输出格式:Markdown。正文结构清晰,可直接进入文章编辑器。
@@ -301,14 +302,10 @@ runtime:
zh-CN: "输出语言:中文简体。"
en-US: "Output language: English."
article_imitation_setting_labels:
industry: "行业/场景"
brand_name: "品牌/主体"
region: "地域"
target_audience: "目标读者"
content_goal: "内容目标"
tone: "语气风格"
length_goal: "篇幅要求"
keywords: "关键词"
keywords: "优化关键词"
preserve_points: "必须保留/强调"
avoid_points: "需要规避"
extra_requirements: "其他要求"
@@ -47,13 +47,8 @@ type GenerateImitationRequest struct {
SourceURL string `json:"source_url" binding:"required"`
SourceTitle string `json:"source_title"`
Locale string `json:"locale"`
Industry string `json:"industry"`
BrandName string `json:"brand_name"`
Region string `json:"region"`
TargetAudience string `json:"target_audience"`
ContentGoal string `json:"content_goal"`
Tone string `json:"tone"`
LengthGoal string `json:"length_goal"`
Keywords []string `json:"keywords"`
PreservePoints string `json:"preserve_points"`
AvoidPoints string `json:"avoid_points"`
@@ -135,6 +130,9 @@ func (s *ArticleImitationService) Generate(ctx context.Context, req GenerateImit
if err != nil {
return nil, err
}
if strings.TrimSpace(req.BrandName) == "" {
return nil, response.ErrBadRequest(40001, "brand_name_required", "brand_name is required")
}
quotaRepo := repository.NewQuotaRepository(s.pool)
balance, err := quotaRepo.GetCurrentBalance(ctx, actor.TenantID, "article_generation")
@@ -587,13 +585,9 @@ func buildImitationInputParams(sourceURL string, req GenerateImitationRequest) m
"source_url": sourceURL,
"source_title": strings.TrimSpace(req.SourceTitle),
"locale": normalizeImitationLocale(req.Locale),
"industry": strings.TrimSpace(req.Industry),
"brand_name": strings.TrimSpace(req.BrandName),
"region": strings.TrimSpace(req.Region),
"target_audience": strings.TrimSpace(req.TargetAudience),
"content_goal": strings.TrimSpace(req.ContentGoal),
"tone": strings.TrimSpace(req.Tone),
"length_goal": strings.TrimSpace(req.LengthGoal),
"length_goal": "2000字左右",
"keywords": normalizeImitationKeywords(req.Keywords),
"preserve_points": strings.TrimSpace(req.PreservePoints),
"avoid_points": strings.TrimSpace(req.AvoidPoints),
@@ -631,12 +625,8 @@ func buildImitationGenerationPrompt(params map[string]interface{}, sourceContent
}
var settings strings.Builder
appendPromptLine(&settings, "industry", extractString(params, "industry"))
appendPromptLine(&settings, "brand_name", extractString(params, "brand_name"))
appendPromptLine(&settings, "region", extractString(params, "region"))
appendPromptLine(&settings, "target_audience", extractString(params, "target_audience"))
appendPromptLine(&settings, "content_goal", extractString(params, "content_goal"))
appendPromptLine(&settings, "tone", extractString(params, "tone"))
appendPromptLine(&settings, "length_goal", extractString(params, "length_goal"))
if len(keywords) > 0 {
appendPromptLine(&settings, "keywords", strings.Join(keywords, "、"))
@@ -674,12 +664,8 @@ func buildImitationKnowledgeQuery(params map[string]interface{}) string {
}
appendValue(extractString(params, "source_title"))
appendValue(extractString(params, "industry"))
appendValue(extractString(params, "brand_name"))
appendValue(extractString(params, "region"))
appendValue(extractString(params, "target_audience"))
appendValue(extractString(params, "content_goal"))
appendValue(extractString(params, "tone"))
appendValue(strings.Join(extractStringList(params["keywords"], 16), "\n"))
appendValue(extractString(params, "extra_requirements"))