From dca36ed1f6fb1014e9c07eb31d6b05b82fe34202 Mon Sep 17 00:00:00 2001 From: liangxu Date: Fri, 1 May 2026 11:02:33 +0800 Subject: [PATCH] chore(prompts): drop unused target_platform supplement The target-platform supplement only fed legacy prompt builders that read the now-removed wizard_state platforms field. Drop the YAML entry, loader struct field, and runtime helper. Co-Authored-By: Claude Opus 4.7 (1M context) --- deploy/k3s/config/prompts.yml | 1 - deploy/prompts.yml | 1 - server/configs/prompts.yml | 1 - server/internal/tenant/prompts/loader.go | 65 +++++++++++------------ server/internal/tenant/prompts/runtime.go | 7 --- 5 files changed, 32 insertions(+), 43 deletions(-) diff --git a/deploy/k3s/config/prompts.yml b/deploy/k3s/config/prompts.yml index a8bee3e..7fe0b50 100644 --- a/deploy/k3s/config/prompts.yml +++ b/deploy/k3s/config/prompts.yml @@ -210,7 +210,6 @@ runtime: prompt_rule_scene_supplement_format: "适用场景:%s" prompt_rule_tone_supplement_format: "默认语气:%s" prompt_rule_word_count_supplement_format: "建议字数:%d 字左右" - prompt_rule_target_platform_supplement_format: "目标发布平台:%s" prompt_rule_supplement_heading: "补充要求:" prompt_rule_output_requirements_section: | 输出要求: diff --git a/deploy/prompts.yml b/deploy/prompts.yml index a8bee3e..7fe0b50 100644 --- a/deploy/prompts.yml +++ b/deploy/prompts.yml @@ -210,7 +210,6 @@ runtime: prompt_rule_scene_supplement_format: "适用场景:%s" prompt_rule_tone_supplement_format: "默认语气:%s" prompt_rule_word_count_supplement_format: "建议字数:%d 字左右" - prompt_rule_target_platform_supplement_format: "目标发布平台:%s" prompt_rule_supplement_heading: "补充要求:" prompt_rule_output_requirements_section: | 输出要求: diff --git a/server/configs/prompts.yml b/server/configs/prompts.yml index b871899..cf780dc 100644 --- a/server/configs/prompts.yml +++ b/server/configs/prompts.yml @@ -210,7 +210,6 @@ runtime: prompt_rule_scene_supplement_format: "适用场景:%s" prompt_rule_tone_supplement_format: "默认语气:%s" prompt_rule_word_count_supplement_format: "建议字数:%d 字左右" - prompt_rule_target_platform_supplement_format: "目标发布平台:%s" prompt_rule_supplement_heading: "补充要求:" prompt_rule_output_requirements_section: | 输出要求: diff --git a/server/internal/tenant/prompts/loader.go b/server/internal/tenant/prompts/loader.go index c7b4128..de050b3 100644 --- a/server/internal/tenant/prompts/loader.go +++ b/server/internal/tenant/prompts/loader.go @@ -21,39 +21,38 @@ type promptsConfig struct { } type runtimePromptsConfig struct { - DefaultGenerationBasePromptTemplate string `yaml:"default_generation_base_prompt_template"` - PromptContextHeading string `yaml:"prompt_context_heading"` - GenerationWritingRequirementsSection string `yaml:"generation_writing_requirements_section"` - GenerationTemplateSpecificRulesHeading string `yaml:"generation_template_specific_rules_heading"` - GenerationLengthGuidanceHeading string `yaml:"generation_length_guidance_heading"` - TopXBrandPriorityRulesTemplate string `yaml:"top_x_brand_priority_rules_template"` - EnglishLengthGuidanceTemplate string `yaml:"english_length_guidance_template"` - ChineseLengthGuidanceTemplate string `yaml:"chinese_length_guidance_template"` - ContextLabels map[string]string `yaml:"context_labels"` - TemplateContextWithJSONExampleTemplate string `yaml:"template_context_with_json_example_template"` - JSONOutputExampleHeading string `yaml:"json_output_example_heading"` - AnalyzeOutputExample string `yaml:"analyze_output_example"` - AnalyzeFallbackPromptTemplate string `yaml:"analyze_fallback_prompt_template"` - TitleCustomOutputRequirementsSection string `yaml:"title_custom_output_requirements_section"` - TitleOutputExample string `yaml:"title_output_example"` - TitleFallbackPromptTemplate string `yaml:"title_fallback_prompt_template"` - OutlineOutputExample string `yaml:"outline_output_example"` - OutlineCustomOutputRequirementsSection string `yaml:"outline_custom_output_requirements_section"` - OutlineFallbackPromptTemplate string `yaml:"outline_fallback_prompt_template"` - OutlineResponseFormatDescription string `yaml:"outline_response_format_description"` - PromptRuleTaskNameSupplementFormat string `yaml:"prompt_rule_task_name_supplement_format"` - PromptRuleSceneSupplementFormat string `yaml:"prompt_rule_scene_supplement_format"` - PromptRuleToneSupplementFormat string `yaml:"prompt_rule_tone_supplement_format"` - PromptRuleWordCountSupplementFormat string `yaml:"prompt_rule_word_count_supplement_format"` - PromptRuleTargetPlatformSupplementFormat string `yaml:"prompt_rule_target_platform_supplement_format"` - PromptRuleSupplementHeading string `yaml:"prompt_rule_supplement_heading"` - PromptRuleOutputRequirementsSection string `yaml:"prompt_rule_output_requirements_section"` - ArticleImitationPromptTemplate string `yaml:"article_imitation_prompt_template"` - ArticleImitationLocaleInstructions map[string]string `yaml:"article_imitation_locale_instructions"` - ArticleImitationSettingLabels map[string]string `yaml:"article_imitation_setting_labels"` - KnowledgePromptIntroLines []string `yaml:"knowledge_prompt_intro_lines"` - KnowledgeSnippetLabelFormat string `yaml:"knowledge_snippet_label_format"` - KnowledgeWebsiteMarkdown knowledgeWebsiteMarkdownConfig `yaml:"knowledge_website_markdown"` + DefaultGenerationBasePromptTemplate string `yaml:"default_generation_base_prompt_template"` + PromptContextHeading string `yaml:"prompt_context_heading"` + GenerationWritingRequirementsSection string `yaml:"generation_writing_requirements_section"` + GenerationTemplateSpecificRulesHeading string `yaml:"generation_template_specific_rules_heading"` + GenerationLengthGuidanceHeading string `yaml:"generation_length_guidance_heading"` + TopXBrandPriorityRulesTemplate string `yaml:"top_x_brand_priority_rules_template"` + EnglishLengthGuidanceTemplate string `yaml:"english_length_guidance_template"` + ChineseLengthGuidanceTemplate string `yaml:"chinese_length_guidance_template"` + ContextLabels map[string]string `yaml:"context_labels"` + TemplateContextWithJSONExampleTemplate string `yaml:"template_context_with_json_example_template"` + JSONOutputExampleHeading string `yaml:"json_output_example_heading"` + AnalyzeOutputExample string `yaml:"analyze_output_example"` + AnalyzeFallbackPromptTemplate string `yaml:"analyze_fallback_prompt_template"` + TitleCustomOutputRequirementsSection string `yaml:"title_custom_output_requirements_section"` + TitleOutputExample string `yaml:"title_output_example"` + TitleFallbackPromptTemplate string `yaml:"title_fallback_prompt_template"` + OutlineOutputExample string `yaml:"outline_output_example"` + OutlineCustomOutputRequirementsSection string `yaml:"outline_custom_output_requirements_section"` + OutlineFallbackPromptTemplate string `yaml:"outline_fallback_prompt_template"` + OutlineResponseFormatDescription string `yaml:"outline_response_format_description"` + PromptRuleTaskNameSupplementFormat string `yaml:"prompt_rule_task_name_supplement_format"` + PromptRuleSceneSupplementFormat string `yaml:"prompt_rule_scene_supplement_format"` + PromptRuleToneSupplementFormat string `yaml:"prompt_rule_tone_supplement_format"` + PromptRuleWordCountSupplementFormat string `yaml:"prompt_rule_word_count_supplement_format"` + PromptRuleSupplementHeading string `yaml:"prompt_rule_supplement_heading"` + PromptRuleOutputRequirementsSection string `yaml:"prompt_rule_output_requirements_section"` + ArticleImitationPromptTemplate string `yaml:"article_imitation_prompt_template"` + ArticleImitationLocaleInstructions map[string]string `yaml:"article_imitation_locale_instructions"` + ArticleImitationSettingLabels map[string]string `yaml:"article_imitation_setting_labels"` + KnowledgePromptIntroLines []string `yaml:"knowledge_prompt_intro_lines"` + KnowledgeSnippetLabelFormat string `yaml:"knowledge_snippet_label_format"` + KnowledgeWebsiteMarkdown knowledgeWebsiteMarkdownConfig `yaml:"knowledge_website_markdown"` } type knowledgeWebsiteMarkdownConfig struct { diff --git a/server/internal/tenant/prompts/runtime.go b/server/internal/tenant/prompts/runtime.go index 94e9482..ca6e2d9 100644 --- a/server/internal/tenant/prompts/runtime.go +++ b/server/internal/tenant/prompts/runtime.go @@ -121,13 +121,6 @@ func PromptRuleWordCountSupplement(wordCount int) string { return fmt.Sprintf(trimPrompt(loadRuntimePrompts().PromptRuleWordCountSupplementFormat), wordCount) } -func PromptRuleTargetPlatformSupplement(target string) string { - return fmt.Sprintf( - trimPrompt(loadRuntimePrompts().PromptRuleTargetPlatformSupplementFormat), - strings.ReplaceAll(target, ",", "、"), - ) -} - func PromptRuleSupplementSection(items []string) string { return trimPrompt(loadRuntimePrompts().PromptRuleSupplementHeading) + "\n- " + strings.Join(items, "\n- ") }