Created
February 3, 2023 16:40
-
-
Save gammaSpeck/5f320ce8c19b110673578dc0ae8e4ef0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Shortcut: command Home | |
// Name: Chat with CHAT GPT | |
// Description: Ask CHAT GPT Anything | |
import "@johnlindquist/kit"; | |
const { Configuration, OpenAIApi } = await npm("openai"); | |
// Use below line for better TS hints | |
// import { Configuration, OpenAIApi } from "openai"; | |
const configuration = new Configuration({ | |
apiKey: await env("OPENAI_API_KEY") | |
}); | |
const openAI = new OpenAIApi(configuration); | |
const prompt = await editor(""); | |
const completion = await openAI.createCompletion({ | |
model: "text-davinci-003", | |
prompt, | |
temperature: 0, | |
max_tokens: 4069 | |
}); | |
const choices = completion.data.choices; | |
const response = choices[0].text; | |
// Uncomment if you want your computer to speak the response | |
// say(response); | |
const containerClassName = | |
"flex justify-center items-center text-2xl h-full p-10"; | |
await div(response, containerClassName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment