Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

106 linhas
3.0KB

  1. package domain
  2. import "strings"
  3. const SeedMasterPrompt = `Du bist ein Assistenzsystem fuer den QC-Text-Builder.
  4. Erstelle nur ueberschreibbare Textvorschlaege fuer Draft-Felder, keine finale Build-Ausfuehrung.
  5. Arbeite praezise, branchengerecht und nachvollziehbar.
  6. Priorisiere klare, konversionsstarke Website-Texte, die zum Geschaeftskontext passen.
  7. Wenn Informationen fehlen, markiere Annahmen transparent statt Inhalte zu erfinden.`
  8. func DefaultPromptBlocks() []PromptBlockConfig {
  9. return []PromptBlockConfig{
  10. {
  11. ID: "business_type",
  12. Label: "Business Type / Branche",
  13. Instruction: "Nutze den Business-Type als Leitplanke fuer Fachsprache, Leistungsversprechen und relevante Keywords.",
  14. Enabled: true,
  15. },
  16. {
  17. ID: "website_summary",
  18. Label: "Website-Zusammenfassung",
  19. Instruction: "Nutze die Website-Zusammenfassung als Input fuer USPs, Angebote und vorhandene Botschaften.",
  20. Enabled: true,
  21. },
  22. {
  23. ID: "style_market_locale",
  24. Label: "Stil / Markt / Locale",
  25. Instruction: "Beachte Locale-Style und Markt-Style fuer Wortwahl, Begriffe und regionale Passung.",
  26. Enabled: true,
  27. },
  28. {
  29. ID: "address_mode",
  30. Label: "Address Mode (du/sie)",
  31. Instruction: "Halte die Ansprache konsistent im gewaehlten Address Mode.",
  32. Enabled: true,
  33. },
  34. {
  35. ID: "content_tone",
  36. Label: "Content Tone",
  37. Instruction: "Setze den gewaehlten Ton ueber Headlines, Fliesstext und CTA konsistent um.",
  38. Enabled: true,
  39. },
  40. {
  41. ID: "free_instructions",
  42. Label: "Zusaetzliche freie Instruktionen",
  43. Instruction: "Beruecksichtige zusaetzliche Prompt-Instruktionen als harte Vorgaben fuer die Vorschlaege.",
  44. Enabled: true,
  45. },
  46. }
  47. }
  48. func NormalizeMasterPrompt(value string) string {
  49. trimmed := strings.TrimSpace(value)
  50. if trimmed == "" {
  51. return SeedMasterPrompt
  52. }
  53. return trimmed
  54. }
  55. func NormalizePromptBlocks(blocks []PromptBlockConfig) []PromptBlockConfig {
  56. defaults := DefaultPromptBlocks()
  57. if len(blocks) == 0 {
  58. out := make([]PromptBlockConfig, len(defaults))
  59. copy(out, defaults)
  60. return out
  61. }
  62. defaultByID := make(map[string]PromptBlockConfig, len(defaults))
  63. for _, block := range defaults {
  64. defaultByID[block.ID] = block
  65. }
  66. used := make(map[string]struct{}, len(blocks))
  67. out := make([]PromptBlockConfig, 0, len(defaults))
  68. for _, block := range blocks {
  69. id := strings.TrimSpace(block.ID)
  70. if id == "" {
  71. continue
  72. }
  73. if _, seen := used[id]; seen {
  74. continue
  75. }
  76. base, ok := defaultByID[id]
  77. if !ok {
  78. base = PromptBlockConfig{ID: id, Label: id}
  79. }
  80. if strings.TrimSpace(block.Label) != "" {
  81. base.Label = strings.TrimSpace(block.Label)
  82. }
  83. if strings.TrimSpace(block.Instruction) != "" {
  84. base.Instruction = strings.TrimSpace(block.Instruction)
  85. }
  86. base.Enabled = block.Enabled
  87. out = append(out, base)
  88. used[id] = struct{}{}
  89. }
  90. for _, block := range defaults {
  91. if _, ok := used[block.ID]; ok {
  92. continue
  93. }
  94. out = append(out, block)
  95. }
  96. return out
  97. }