Rephrase Text With ChatGpt πŸ”§

Rephrase the selected text with ChatGpt.

// Name: Rephrase Text With ChatGpt
// Description: Rephrase the selected text with ChatGpt.
// Author: Eduard Uffelmann    
// Linkedin: https://www.linkedin.com/in/euffelmann/
// Twitter: @schmedu_
// Website: https://schmedu.com

import "@johnlindquist/kit";
import { startChat } from "../lib/common";

let selectedText = await getSelectedText();

let writingStyle = await arg(
    { placeholder: "Choose writing style", strict: false },
    [
        "default",
        "academic",
        "analytical",
        "argumentative",
        "conversational",
        "creative",
        "descriptive",
        "epigrammatic",
        "epistolary",
        "expository",
        "informative",
        "instructive",
        "journalistic",
        "metaphorical",
        "narrative",
        "persuasive",
        "poetic",
        "satirical",
        "critical",
        "technical",
    ]
);

let tone = await arg({ placeholder: "Choose tonality", strict: false }, [
    "default",
    "authoritative",
    "clinical",
    "cold",
    "confident",
    "cynical",
    "emotional",
    "empathetic",
    "formal",
    "friendly",
    "humorous",
    "informal",
    "ironic",
    "optimistic",
    "pessimistic",
    "playful",
    "sarcastic",
    "serious",
    "sympathetic",
    "tentative",
    "caring",
    "casual",
    "cheerful",
    "coarse",
    "conservative",
    "conversational",
    "creative",
    "dry",
    "edgy",
    "enthusiastic",
    "expository",
    "frank",
    "fun",
    "funny",
    "informative",
    "irreverent",
    "journalistic",
    "matteroffact",
    "nostalgic",
    "objective",
    "passionate",
    "poetic",
    "professional",
    "provocative",
    "quirky",
    "respectful",
    "romantic",
    "smart",
    "snarky",
    "subjective",
    "trendy",
    "trustworthy",
    "unapologetic",
    "upbeat",
    "witty",
]);

let input = `Could you please rephrase the following text and use a ${writingStyle} writing style and ${tone} tone? Just answer with your corrected text.
\`\`\`
${selectedText}
\`\`\``;

await startChat({
    prompt: input,
});
    
πŸ“₯ Input
Selected Text
πŸ“€ Output
Changed Selected Text
πŸ’» Setup
Easy
🏷 Tags️
text, replace text