Update openai.js

This commit is contained in:
Artemy 2023-09-11 10:53:21 +03:00
parent 2ae13e6079
commit 8ed77ea3f9

View file

@ -15,16 +15,17 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Configuration, OpenAIApi } from "openai"; import OpenAi from "openai";
async function Complete(text) { async function Complete(text) {
document.body.style.cursor = "wait"; document.body.style.cursor = "wait";
let initText = text; let initText = text;
const configuration = new Configuration({ const configuration = new OpenAi({
apiKey: settings.openAiKey, apiKey: settings.openAiKey,
}); });
const openai = new OpenAIApi(configuration); const openai = new OpenAIApi(configuration);
const response = await openai.createCompletion({ const response = await openai.createCompletion({
model: "text-davinci-003", model: "text-davinci-003",