DEV Community

Cover image for Content creation by ChatGPT
Peter Vivo
Peter Vivo

Posted on • Updated on

Content creation by ChatGPT

cover created by DALL-E lab 🇭🇺 magyarul

TLDR;

Demonstration of creating a short fantasy story with original character plot using a series of small requests from ChatGPT. This process can also be applied to creating programming content. Asking multiple small questions leads to a complex result.
- ChatGPT fetch function in JS at end of post -

write a story

Improved prompt led to creation of a new fantasy story using randomly generated names from ChatGPT, despite receiving many names that were already associated with existing fantasy characters.

Plot: generate the main characters

This is prompt give much nicer result:

🥸 Give me 32 fantasy names mixed by (Nordic: 25%, African: 25%, Saxon: 35%, left Old Persian)

Arngrim, Ashafta, Brekkr, Aricius, Cynvelin, Dagna, Eirika, Eldred, Falkor, Gudruna, Haldor, Imani, Jorunn, Kianus, Leifr, Luminata, Nefertiti, Osvaldr, Penda, Ragnar, Safiya, Thalia, Ulfr, Varda, Wilfred, Xanthe, Yaa, Zaria, Arash, Bassir, Caius, Dagnus

But nee to improve by:

🥸 Generate again, but each name have sure and fore name too

Arngrim Odinson, Ashafta Neferkare, Brekkr Ulfdottir, ...

Next iteration is ...

🥸 Generat again extend fantasy class

  • 1) Arngrim Odinson, Warrior
  • 2) Ashafta Neferkare, Mage
  • 3) Brekkr Ulfdottir, Bard
  • 4) Aricius Kwasi, Rogue
  • 5) Cynvelin Astrid, Cleric
  • 6) Dagna Jorunnson, Paladin
  • 7) Eirika Leifsdottir, Druid
  • 8) Eldred Luminata, Sorcerer
  • 9) Falkor Thalia, Ranger
  • 10) Gudruna Osvaldrson, Necromancer ....

... and the final one:

🥸 Generate only 7 but extended with nickname and 1 sentence of story about that character

  • 1) Arngrim Odinson, "The Thunder God", Warrior - Arngrim's reputation as a fearsome warrior precedes him, and he's known for his unshakable bravery and quick thinking in battle.
  • 2) Ashafta Neferkare, "The Sun Queen", Mage - Ashafta's mastery of magic and her unwavering sense of justice have made her a beloved leader among her people.
  • 3) Brekkr Ulfdottir, "The Unbreakable", Bard - Brekkr's music has the power to move even the hardest of hearts, but in battle, she's equally fearsome with her two-handed battleaxe.
  • 4) Aricius Kwasi, "The Shadow Stalker", Rogue - Aricius moves unseen and unheard, striking when his enemies least expect it.
  • 5) Cynvelin Astrid, "The Light Bringer", Cleric - Cynvelin's devotion to her deity is unshakable, and she'll go to great lengths to protect the innocent and vanquish evil.
  • 6) Dagna Jorunnson, "The Firestarter", Paladin - Dagna is a champion of justice and a devout follower of her deity, and she'll stop at nothing to defend the innocent and bring down evil.
  • 7) Eirika Leifsdottir, "The Wild Huntress", Druid - Eirika is one with nature, able to call upon the power of the elements and the beasts of the forest to do her bidding.

Write the story

This process is really simple, I using the rule: Small setps.

🥸 Give me interaction between Kwasi and Dagna

Kwasi and Dagna meet in a tavern, both seeking a good meal and a hot drink after a long day of traveling. Kwasi is sitting in a corner, keeping to himself and observing the other patrons, while Dagna is up at the bar, chatting with the bartender and enjoying a mug of ale.

As the night wears on, Kwasi overhears Dagna talking about her quest to vanquish a group of bandits who have been terrorizing a nearby village. Intrigued, he walks over and introduces himself.

Kwasi: "Pardon me, but I couldn't help but overhear your conversation. I may have some information that could be of use to you."

Dagna: "Oh? And what information would that be?"

Kwasi: "I've been tracking these bandits for a while now. I know their hideout, and I could show you the way."

Dagna raises an eyebrow, suspicious of Kwasi's motives. But after a moment's consideration, she decides to take him up on his offer.

Dagna: "All right. Lead the way, then. I could use all the help I can get."

Kwasi nods, and the two of them head out into the night, ready to bring the bandits to justice.

🥸 Keep going the story when meet Brekkr

As Kwasi and Dagna make their way to the bandits' hideout, they come across a lone figure on the road. It's Brekkr, a fearsome warrior from a nearby village, who has been tracking the same group of bandits.

Kwasi: "Hold on, who are you?"

Brekkr: "I'm Brekkr. And you two are not the only ones hunting these bandits. What's your business with them?"

Dagna: "We were hired to bring them to justice for their crimes in our village. And you?"

Brekkr: "I have my own reasons for seeking them out. But I'm not one to turn down extra help. Join forces with me, and together we'll take them down once and for all."

Kwasi and Dagna exchange a look, both feeling a sense of respect and fear for the warrior in front of them. They both agree to work together with Brekkr, forming a formidable trio.

As they continue their journey, they talk and share their stories, learning more about each other. They face challenges and overcome obstacles, honing their skills and becoming a well-oiled machine.

Finally, they reach the bandits' hideout, ready for a final showdown. The fight is intense, but in the end, they emerge victorious. The bandits are brought to justice, and Kwasi, Dagna, and Brekkr become known as the heroes who saved the village.

🥸 Finally the party will found the leader of bandits was Astrid, which was change the plans

As Kwasi, Dagna, and Brekkr finally find the leader of the bandits, they are shocked to discover that it's Astrid, a former companion of theirs on their previous adventures.

Astrid: "Ha! I never expected to see you three here. What brings you to my humble abode?"

Brekkr: "We've come to bring you to justice, Astrid. You and your bandits have caused too much harm in our villages."

Astrid: "Justice? How naive of you, Brekkr. In this world, there is only power, and those who have it. And I have it now, with this band of loyal followers."

Kwasi: "Why, Astrid? What happened to you? We used to be friends."

Astrid: "Friends? You were just convenient allies, nothing more. When I saw the opportunity to gather power and resources, I took it. And now, I have everything I want."

Dagna: "We can't let you continue like this. It's not right."

Astrid: "Right or wrong, it doesn't matter. I have an army of followers, and you three are no match for us. Surrender now, or face the consequences."

The three heroes exchange a determined look, knowing that they can't let Astrid get away with her crimes. A fierce battle ensues, with both sides giving it their all. In the end, the heroes emerge victorious, capturing Astrid and putting an end to her reign of terror.

But the victory is bittersweet, as they realize the true extent of Astrid's corruption and the path she took. They make sure she is brought to justice, and work to restore peace to the affected villages. And although they can never fully forget their former friend's betrayal, they continue on their journey, always looking for the next adventure.

the end

Bonus

If you want to try ChatGPT from JavaScript, use this simple script:

// get from :: https://platform.openai.com/account/api-keys
const getHeader = key => new Headers({
  'Authorization': `Bearer ${key}`, 
  'Content-Type': 'application/json'
});
const getAI = (headers=getHeader(prompt()), view=console.log) => (seek) => fetch(
  "https://api.openai.com/v1/completions",
  {
    method: 'POST',
    headers,
    body: JSON.stringify({
      model: "text-davinci-003",
      prompt: seek,
      max_tokens: 500,
      temperature: 0.5
    })
  }
)
  .then(res => res.json())
  .then(res => res.choices[0].text)
  .then(view)
  .catch(console.error)
;
Enter fullscreen mode Exit fullscreen mode

Then get your asking function, which one ask your authorization key, can you get from: openai get api keys

let ai = getAI()
Enter fullscreen mode Exit fullscreen mode

... after this done, you can ask any question in console, like this:

ai('generate 10 names sure and last name too')
Enter fullscreen mode Exit fullscreen mode

Latest comments (0)