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: ...
222 lines
5.9 KiB
TypeScript
222 lines
5.9 KiB
TypeScript
import type { Style, StyleCategory } from "./types";
|
|
|
|
export const categories: StyleCategory[] = [
|
|
{ id: "general", label: "General", emoji: "🎭" },
|
|
{ id: "british", label: "British Slang", emoji: "🇬🇧" },
|
|
{ id: "american", label: "American Slang", emoji: "🇺🇸" },
|
|
{ id: "fun", label: "Fun", emoji: "🏴☠️" },
|
|
{ id: "got", label: "Game of Thrones", emoji: "🐉" },
|
|
{ id: "dystopian", label: "Dystopian", emoji: "📰" },
|
|
];
|
|
|
|
export const styles: Style[] = [
|
|
// General
|
|
{
|
|
id: "sarcastic",
|
|
label: "Sarcastic",
|
|
categoryId: "general",
|
|
promptModifier: "Rewrite in a sarcastic, snarky tone with biting wit",
|
|
},
|
|
{
|
|
id: "formal",
|
|
label: "Formal",
|
|
categoryId: "general",
|
|
promptModifier: "Rewrite in a highly formal, professional tone",
|
|
},
|
|
{
|
|
id: "casual",
|
|
label: "Casual",
|
|
categoryId: "general",
|
|
promptModifier: "Rewrite in a laid-back, casual conversational tone",
|
|
},
|
|
{
|
|
id: "academic",
|
|
label: "Academic",
|
|
categoryId: "general",
|
|
promptModifier:
|
|
"Rewrite in an academic, scholarly tone with precise language",
|
|
},
|
|
{
|
|
id: "poetic",
|
|
label: "Poetic",
|
|
categoryId: "general",
|
|
promptModifier:
|
|
"Rewrite in a poetic, lyrical style with imagery and rhythm",
|
|
},
|
|
{
|
|
id: "passive-aggressive",
|
|
label: "Passive-Aggressive",
|
|
categoryId: "general",
|
|
promptModifier:
|
|
"Rewrite in a passive-aggressive tone with backhanded compliments",
|
|
},
|
|
|
|
// British Slang
|
|
{
|
|
id: "british-polite",
|
|
label: "Polite (British)",
|
|
categoryId: "british",
|
|
promptModifier:
|
|
"Rewrite in polite British English with understated courtesy",
|
|
},
|
|
{
|
|
id: "british-formal",
|
|
label: "Formal (British)",
|
|
categoryId: "british",
|
|
promptModifier:
|
|
"Rewrite in formal British English with proper stiff-upper-lip expression",
|
|
},
|
|
{
|
|
id: "british-witty",
|
|
label: "Witty (British)",
|
|
categoryId: "british",
|
|
promptModifier:
|
|
"Rewrite in witty British style with dry humor and clever wordplay",
|
|
},
|
|
{
|
|
id: "british-gentlemanly",
|
|
label: "Gentlemanly",
|
|
categoryId: "british",
|
|
promptModifier: "Rewrite as a proper British gentleman would speak",
|
|
},
|
|
{
|
|
id: "british-upper-class",
|
|
label: "Upper Class",
|
|
categoryId: "british",
|
|
promptModifier:
|
|
"Rewrite in the manner of British upper-class speech with RP accent sensibilities",
|
|
},
|
|
{
|
|
id: "british-royal",
|
|
label: "Royal",
|
|
categoryId: "british",
|
|
promptModifier:
|
|
"Rewrite as if speaking with royal British formality and majesty",
|
|
},
|
|
{
|
|
id: "british-victorian",
|
|
label: "Victorian",
|
|
categoryId: "british",
|
|
promptModifier:
|
|
"Rewrite in Victorian-era British English with archaic formality",
|
|
},
|
|
{
|
|
id: "british-downton",
|
|
label: "Downton Abbey",
|
|
categoryId: "british",
|
|
promptModifier: "Rewrite in the style of Downton Abbey characters",
|
|
},
|
|
|
|
// American Slang
|
|
{
|
|
id: "american-new-yorker",
|
|
label: "New Yorker",
|
|
categoryId: "american",
|
|
promptModifier:
|
|
"Rewrite in a New York City style with directness and local flavor",
|
|
},
|
|
{
|
|
id: "american-black-slang",
|
|
label: "Black American Slang",
|
|
categoryId: "american",
|
|
promptModifier:
|
|
"Rewrite in Black American Vernacular English (AAVE) with cultural flair",
|
|
},
|
|
{
|
|
id: "american-southern",
|
|
label: "Southern",
|
|
categoryId: "american",
|
|
promptModifier: "Rewrite with Southern American charm and hospitality",
|
|
},
|
|
{
|
|
id: "american-redneck",
|
|
label: "Redneck",
|
|
categoryId: "american",
|
|
promptModifier:
|
|
"Rewrite in a rural American redneck style with country twang",
|
|
},
|
|
|
|
// Fun
|
|
{
|
|
id: "pirate",
|
|
label: "Pirate",
|
|
categoryId: "fun",
|
|
promptModifier: "Rewrite like a pirate with arrrs and nautical terms",
|
|
},
|
|
{
|
|
id: "shakespearean",
|
|
label: "Shakespearean",
|
|
categoryId: "fun",
|
|
promptModifier:
|
|
"Rewrite in Shakespearean English with thee, thou, and poetic flourish",
|
|
},
|
|
{
|
|
id: "gen-z",
|
|
label: "Gen Z Slang",
|
|
categoryId: "fun",
|
|
promptModifier:
|
|
"Rewrite in Gen Z slang with no cap, fr, and modern internet vernacular",
|
|
},
|
|
|
|
// Game of Thrones
|
|
{
|
|
id: "got-kings-landing",
|
|
label: "King's Landing",
|
|
categoryId: "got",
|
|
promptModifier:
|
|
"Rewrite as Cersi, Tywin, Tyrion or a scheming noble from Kings Landing would speak",
|
|
},
|
|
{
|
|
id: "got-wildlings",
|
|
label: "Wildlings",
|
|
categoryId: "got",
|
|
promptModifier:
|
|
"Rewrite in the rough, free-spirited manner of the Free Folk wildlings, like how Ygritte talks",
|
|
},
|
|
{
|
|
id: "got-winterfell",
|
|
label: "Winterfell",
|
|
categoryId: "got",
|
|
promptModifier:
|
|
"Rewrite with the honor-bound stoicism of a Stark from Winterfell",
|
|
},
|
|
|
|
// Dystopian
|
|
{
|
|
id: "newspeak",
|
|
label: "Newspeak (Orwellian)",
|
|
categoryId: "dystopian",
|
|
promptModifier:
|
|
"Rewrite in Orwellian Newspeak, minimizing vocabulary and thought as the Party demands",
|
|
},
|
|
];
|
|
|
|
export const intensityMap: Record<
|
|
number,
|
|
{ label: string; instruction: string }
|
|
> = {
|
|
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[] {
|
|
return styles.filter((s) => s.categoryId === categoryId);
|
|
}
|
|
|
|
export function getStyleById(styleId: string): Style | undefined {
|
|
return styles.find((s) => s.id === styleId);
|
|
}
|
|
|
|
export function getCategoryById(categoryId: string): StyleCategory | undefined {
|
|
return categories.find((c) => c.id === categoryId);
|
|
}
|
|
|
|
export function getIntensityConfig(
|
|
intensity: number,
|
|
): { label: string; instruction: string } | undefined {
|
|
return intensityMap[intensity];
|
|
}
|