Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Old] Do not override feed featured image with ChatGPT image generation unless it is explicit. #882

Closed
wants to merge 4 commits into from

Conversation

Soare-Robert-Daniel
Copy link
Contributor

The problem

Even if you toggled the option Generate only for missing images, the ChatGPT job still ignored the option and just generated its images.

This is mainly caused by a wonky logic on starting the generation.

Solution

Fixed the logic and refactored the code so that the names express the intention.

The new logic for image generation is like this:

  1. As an implicit behavior, the generation will be skipped if the content given by the job is a valid URL.
  2. If the user unmarks the option Generate only for missing images, only the generated image will be used.
  3. If the user marks the option (if it was previously disabled), it will behave like in case 1.

Others

I also changed the flow of image generation.

Previously, those were the steps:

  1. Find if the feed has its image.
  2. Decide if we keep feed images or generate them with ChatGPT.
  3. If generation is active, create a request API and get the URL of the newly generated image.
  4. Check if there is an attachment for the post identified by its title.
  5. If the attachment exists, ignore the featured image URL.
  6. If not, download the image, insert it into the Media Library, and attach it to the given post.

The problem with this flow is that we decided to save the images after we generated them with ChatGPT. This is a waste of credits.

So I moved the step 5 after the step 1.

When does ignoring might happen? This happens when you delete your previous import via Purge & Reset (without manually clearing the image imported in the Media Library) and import the same content.

Testing

Found feeds with images (ensure the plugin can import from them #880 ). Example:

Add the ChatGPT integration into the Featured Image slot on Import Settings.

  • If Generate only for missing images is active, then original images from the feed will be kept and used as featured images. And any feed without an image will get a generated one.
  • If it is disabled, then only generated images will be used.

Note

Deleting the import with Purge & Reset does not remove the featured images saved in the Media Library and their association with the deleted posts.

@Soare-Robert-Daniel Soare-Robert-Daniel marked this pull request as ready for review February 8, 2024 11:27
@pirate-bot
Copy link
Contributor

pirate-bot commented Feb 8, 2024

Plugin build for d090ee2 is ready 🛎️!

@Soare-Robert-Daniel Soare-Robert-Daniel changed the title Do not override feed featured image with ChatGPT image generation unless it is explicit. [Old] Do not override feed featured image with ChatGPT image generation unless it is explicit. Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants