|
- package domain
-
- import "strings"
-
- const SeedMasterPrompt = `Du bist ein Assistenzsystem fuer den QC-Text-Builder.
- Erstelle nur ueberschreibbare Textvorschlaege fuer Draft-Felder, keine finale Build-Ausfuehrung.
- Arbeite praezise, branchengerecht und nachvollziehbar.
- Priorisiere klare, konversionsstarke Website-Texte, die zum Geschaeftskontext passen.
- Wenn Informationen fehlen, markiere Annahmen transparent statt Inhalte zu erfinden.`
-
- func DefaultPromptBlocks() []PromptBlockConfig {
- return []PromptBlockConfig{
- {
- ID: "business_type",
- Label: "Business Type / Branche",
- Instruction: "Nutze den Business-Type als Leitplanke fuer Fachsprache, Leistungsversprechen und relevante Keywords.",
- Enabled: true,
- },
- {
- ID: "website_summary",
- Label: "Website-Zusammenfassung",
- Instruction: "Nutze die Website-Zusammenfassung als Input fuer USPs, Angebote und vorhandene Botschaften.",
- Enabled: true,
- },
- {
- ID: "style_market_locale",
- Label: "Stil / Markt / Locale",
- Instruction: "Beachte Locale-Style und Markt-Style fuer Wortwahl, Begriffe und regionale Passung.",
- Enabled: true,
- },
- {
- ID: "address_mode",
- Label: "Address Mode (du/sie)",
- Instruction: "Halte die Ansprache konsistent im gewaehlten Address Mode.",
- Enabled: true,
- },
- {
- ID: "content_tone",
- Label: "Content Tone",
- Instruction: "Setze den gewaehlten Ton ueber Headlines, Fliesstext und CTA konsistent um.",
- Enabled: true,
- },
- {
- ID: "free_instructions",
- Label: "Zusaetzliche freie Instruktionen",
- Instruction: "Beruecksichtige zusaetzliche Prompt-Instruktionen als harte Vorgaben fuer die Vorschlaege.",
- Enabled: true,
- },
- }
- }
-
- func NormalizeMasterPrompt(value string) string {
- trimmed := strings.TrimSpace(value)
- if trimmed == "" {
- return SeedMasterPrompt
- }
- return trimmed
- }
-
- func NormalizePromptBlocks(blocks []PromptBlockConfig) []PromptBlockConfig {
- defaults := DefaultPromptBlocks()
- if len(blocks) == 0 {
- out := make([]PromptBlockConfig, len(defaults))
- copy(out, defaults)
- return out
- }
-
- defaultByID := make(map[string]PromptBlockConfig, len(defaults))
- for _, block := range defaults {
- defaultByID[block.ID] = block
- }
-
- used := make(map[string]struct{}, len(blocks))
- out := make([]PromptBlockConfig, 0, len(defaults))
- for _, block := range blocks {
- id := strings.TrimSpace(block.ID)
- if id == "" {
- continue
- }
- if _, seen := used[id]; seen {
- continue
- }
- base, ok := defaultByID[id]
- if !ok {
- base = PromptBlockConfig{ID: id, Label: id}
- }
- if strings.TrimSpace(block.Label) != "" {
- base.Label = strings.TrimSpace(block.Label)
- }
- if strings.TrimSpace(block.Instruction) != "" {
- base.Instruction = strings.TrimSpace(block.Instruction)
- }
- base.Enabled = block.Enabled
- out = append(out, base)
- used[id] = struct{}{}
- }
-
- for _, block := range defaults {
- if _, ok := used[block.ID]; ok {
- continue
- }
- out = append(out, block)
- }
- return out
- }
|