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
@@ -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"))