This repository contains a simple JavaScript script to access the ChatGPT API from the Articulate Storyline 360 platform.
The ChatGPT API allows you to integrate the power of OpenAI's language model directly into your applications. With this JavaScript script, you can easily interact with the API from the Articulate Storyline 360 platform, enabling various use cases such as chatbots, text generation, and more.
To use this script, you need to include it in your Articulate Storyline 360 project. Follow these steps:
- Copy the
ChatGPT_Library.js
file contents from this repository. - Using JsDeliver get a cloud link for the
ChatGPT_Service.js
. - Replace the
customLibSrc
const inChatGPT_Library.js
with the link from the JsDeliver. - Add the
ChatGPT_Library.js
to your Articulate Storyline 360 project in the Trigger JavaScript. - Make Sure to create the following variables with the exact Spelling in the Articulate Storyline 360 Project.
message
- PlaceHolder for User Input,
response
- PlaceHolder for Reply from ChatGPT,
chatHistory
- PlaceHolder for saving History in Temp,
role
- By Default you want to have it asuser
,
apiKey
- Your Secret API Key Created from ChatGPT
Once you've included the ChatGPT_Library.js
script in your Articulate Storyline 360 project, you can start using the ChatGPT API. Here's a brief overview of how to use it:
- Initialize the ChatGPT client by providing your API key in your Variable in Articulate Storyline 360 at
apiKey
. - Trigger the
ChatGPT_Library.js
function to send a prompt to the ChatGPT API by User Action Events. - Handle the response from the API, which contains the generated text and Display the Variable
response
in your UI PlaceHolder.