Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.
/ ChatGPT-Utils Public archive

A simple JavaScript library for interfacing with the chat.openai.com website

Notifications You must be signed in to change notification settings

pyscripter99/ChatGPT-Utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

ChatGPT Utils

ChatGPT Utils

ChatGPT Utils is a library for writing your own plugins for ChatGPT. It provides helpers to kick-start your ChatGPT plugin. This is a standalone file so it can be used in user scripts or browser extensions.

Usage

ask(prompt)

Ask is a function that will call submitConversation() and getResult() Use:

await ask("Hello World!");

Return:

Hello! How can I assist you today?

submitConversation(prompt)

SubmitConversation is a function that will write to the text input and press enter. Calls waitForReady() before writing. Does not return output from prompt.

Use:

await submitConversation(prompt);

waitForReady()

WaitForReady is a function that will wait until ChatGPT has finished writing/outputting result.

Use:

await waitForReady();

getResult()

GetResult is a function that will get the last message and return it. Calls waitForReady() before reading.

Use:

await getResult();

Return:

Hello! How can I assist you today?

onReady(callback)

OnReady is a function that will execute the callback when ChatGPT has finished writing/outputting.

Use:

onReady(() => {
    console.log("ChatGPT is ready!")
});

// Or

function handleReady() {
    console.log("ChatGPT is ready!");
}

onReady(handleReady);

onSubmit(callback)

OnSubmit is a function that will execute the callback when the user prompts chatgpt.

onSubmit((prompt) => {
    console.log("User prompted: " + prompt)
});

// Or

function handleSubmit(prompt) {
    console.log("User prompted: " + prompt);
}

onSubmit(handleSubmit);

onResult(callback)

OnResult is a function that will execute the callback when ChatGPT has finished writing a response.

Use:

onResult((result) => {
    console.log("ChatGPT replied: " + result)
});

// Or

function handleResult(result) {
    console.log("ChatGPT replied: " + result);
}

onResult(handleResult);

About

A simple JavaScript library for interfacing with the chat.openai.com website

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published