Rebuild Playground Dashboard Functionality

Dear friends,

I am working on a new project with GPT3 to create blog content. I have some problems to implement the basic functionalities as in the playground dashboard.

For example:

image.

  1. When pressing the “Submit” button for the second time, the previous text should remain in the textarea and the newly generated text should be continued
  2. When pressing the “Redo” button the previously generated text should be deleted
  3. When pressing the “Rewrite”-button the last output should be rewritten

It would be great if someone could give me a sample code or give some hints. I am using flask(python) as a backend and javascript, html, css as frontend.

Thanky you for your help!