Skip to content

Commit

Permalink
🐛 fix(chatgptoot.js): update method name from openai.createImage to o…
Browse files Browse the repository at this point in the history
…penai.images.generate to match API changes

🔥 refactor(chatgptoot.js): remove unused variable 'tokens' in handleImageCommand and handleImageAssistCommand functions
✨ feat(chatgptoot.js): generate new prompt before calling openai.images.generate in handleImageAssistCommand function to improve image generation
  • Loading branch information
skullzarmy committed Oct 31, 2023
1 parent 275ecaf commit c3ce21c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/chatgptoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand Down Expand Up @@ -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`;
Expand Down

0 comments on commit c3ce21c

Please sign in to comment.