Chat GPT integration "Step by step how to"

Hello friends!

@Genesis @OneEagle @thomlin

As the code is being stripped I added txt files, please copy code from them.

Here is the step by step list to integrate basic chat GPT to your site, with copy button for responses a spinning icon while waiting for the response and history list. It is a basic setup with GPT 3.5 Turbo language model. (every model is possible but they have multiple different parameters). You dont need programming skills as I will provide you the codes, just copy and paste :)

we used html, javascript and php:

  • You need an openai key. Go to platform.openai.com create a free account. From the member menu view/create API keys, then note your api key as this key is shown only once. (If lost it you may create another).
  • Go to UNA studio > Pages > Custom > Add New Page
  • system name: aichat, title: aichat
  • Click injections > in the HEAD area paste the text from >>> injections-HEAD.txt from the attachments.
  • Click Cover photo and disable it. > Click Create.

Click on the raw block that you create > Deselect unauthenticed from the visibility list or adjust as you wish for instance you may prefer Administrator access only while testing. Continue setting the RAw block add this code to content area:

>>>refer to RAWBlockcontent.txt in the attachments

now you will need to create a single php page called process.php in the main UNA directory (this is needed not to present our API key to public, but reading it through an ajax call from the page). Replace YOUR_OPENAI_API_KEY with your one.The contents of process.php to be:

>>>refer to processphp.txt in the attachments.

There are some functions in the above codes that are intended to use for debugging when needed.

Navigate to yourunasite/page.php?i=aichat and you will see your functional page :)

If you have questions I will try to help.

  • 3147
  • More
Attachments
Replies (46)
    Login or Join to comment.