From c3ce21c1528b9a573ac581d6ec798c5907d4eddb Mon Sep 17 00:00:00 2001 From: "skllzrmy.tez" Date: Tue, 31 Oct 2023 12:15:44 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(chatgptoot.js):=20update=20m?= =?UTF-8?q?ethod=20name=20from=20openai.createImage=20to=20openai.images.g?= =?UTF-8?q?enerate=20to=20match=20API=20changes=20=F0=9F=94=A5=20refactor(?= =?UTF-8?q?chatgptoot.js):=20remove=20unused=20variable=20'tokens'=20in=20?= =?UTF-8?q?handleImageCommand=20and=20handleImageAssistCommand=20functions?= =?UTF-8?q?=20=E2=9C=A8=20feat(chatgptoot.js):=20generate=20new=20prompt?= =?UTF-8?q?=20before=20calling=20openai.images.generate=20in=20handleImage?= =?UTF-8?q?AssistCommand=20function=20to=20improve=20image=20generation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chatgptoot.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/chatgptoot.js b/app/chatgptoot.js index dd21622..82e3f11 100644 --- a/app/chatgptoot.js +++ b/app/chatgptoot.js @@ -455,8 +455,8 @@ async function processMention(mention, following) { async function handleImageCommand(mention, prompt, isFollowing = false) { if (isFollowing) { try { - const response = await openai.createImage({ prompt, n: 1, size: "512x512" }); - const imageUrl = response.data.data[0].url; + const response = await openai.images.generate({ prompt, n: 1, size: "512x512" }); + const imageUrl = response.data[0].url; const tokens = "unknown"; const filename = `new_toot_${Date.now()}.png`; @@ -532,8 +532,8 @@ async function handleImageAssistCommand(mention, prompt, isFollowing = false) { try { const newPrompt = await generateImagePrompt(prompt); - const response = await openai.createImage({ prompt: newPrompt, n: 1, size: "512x512" }); - const imageUrl = response.data.data[0].url; + const response = await openai.images.generate({ prompt: newPrompt, n: 1, size: "512x512" }); + const imageUrl = response.data[0].url; const tokens = "unknown"; const filename = `new_toot_${Date.now()}.png`;