fix: eliminate redundancy in system prompt

The old prompt had two problems:
1. {style} placeholder was filled with the full promptModifier sentence,
   producing gibberish like "rewrite strongly in a Rewrite in a
   sarcastic... style"
2. The promptModifier was then repeated as its own line

New design separates concerns cleanly:
- intensityMap no longer uses {style} placeholder — instructions are
  pure intensity adverbs ("strongly", "subtly, with a light touch", etc.)
- buildSystemPrompt strips the leading "Rewrite" verb from the style
  modifier and combines both into one non-redundant instruction:
  "Rewrite the text strongly: in a sarcastic, snarky tone with biting wit"

Example outputs by intensity:
  1: Rewrite the text subtly, with a light touch: in a sarcastic...
  3: Rewrite the text strongly: in a sarcastic...
  5: Rewrite the text with absolute maximum intensity, no restraint: ...
This commit is contained in:
2026-04-12 23:23:58 -04:00
parent cb8755f59e
commit 90bb701068
5 changed files with 344 additions and 250 deletions

View File

@@ -195,17 +195,11 @@ export const intensityMap: Record<
number,
{ label: string; instruction: string }
> = {
1: { label: "Subtle", instruction: "lightly hint at a {style} tone" },
2: { label: "Moderate", instruction: "rewrite with a {style} tone" },
3: { label: "Strong", instruction: "rewrite strongly in a {style} style" },
4: {
label: "Heavy",
instruction: "rewrite completely in {style} — fully commit to the voice",
},
5: {
label: "Maximum",
instruction: "go absolutely all-out {style} — no restraint",
},
1: { label: "Subtle", instruction: "subtly, with a light touch" },
2: { label: "Moderate", instruction: "with moderate intensity" },
3: { label: "Strong", instruction: "strongly" },
4: { label: "Heavy", instruction: "completely, fully committing to the voice" },
5: { label: "Maximum", instruction: "with absolute maximum intensity, no restraint" },
};
export function getStylesByCategory(categoryId: string): Style[] {