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

Add new Content Generation Feature #859

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open

Add new Content Generation Feature #859

wants to merge 15 commits into from

Conversation

dkotter
Copy link
Collaborator

@dkotter dkotter commented Feb 28, 2025

Description of the Change

This PR adds in a new Feature to Generate Content, meant to be used to create initial article drafts. Added OpenAI, Azure OpenAI and Ollama as Providers for this Feature, but can add our other generative AI Providers in the future (Gemini, Grok).

This Feature allows you to enter in a summary of what you want written and the LLM will provide a full length article. It also provides the ability to iterate on the article the LLM sends back, if for instance you want to request changes like increasing the length or changing the tone. Once you're happy, you can insert the content into the block editor, overwriting any existing content.

Here's a more detailed step-by-step of how it works:

  1. Enable the Feature then create a new Post
  2. If desired, add a title to this post (will help with results)
  3. In the status sidebar, right below our Generate titles button, there's a new Generate content button. Click this button to start the content generation process
  4. A modal will open where you can enter in the summary of the article you want written. Once ready, click Submit and this will send that summary off to the LLM (along with our base prompt)
  5. Once results are returned, the modal is updated to show the summary you provided and the results the AI provided. You can then choose to accept the content which will overwrite any content you may have had in the block editor with this generated content
  6. If you don't like the results returned, you can click a Start over button which will keep the modal open but clear everything out, allowing you to enter in a new summary
  7. If the results returned are close to what you want but you'd like to iterate a bit, you can click the Request changes button. This will show a new textarea where you can add additional instructions, like Make the content longer/shorter or Change the tone of the content to be more professional
  8. Submitting this new instruction will send the original base prompt, the original summary and the first content AI returned, along with the new instructions. Once results come back, we render these results in the modal along with any previous results (trying to have a UI similar to what ChatGPT provides, where you can see your requests along with the AI responses)
  9. You can iterate as many times as you want, though eventually you'll run into token limits with the context size

Partially closes #841. This Feature does solve the Generate draft post content from simple input but does not do anything in regards to Ensuring the generated drafts align closely with the publication’s tone and style. A follow up PR will be created to help with that piece

Video

classifai-content-generation-demo-short.mp4

Screenshots

Adding summary to generate content Content returned from the AI Iterating on the content returned Rendering the newly iterated content

How to test the Change

Follow the details steps above

Changelog Entry

Added - New Content Generation Feature, allowing the creation of draft content from a summary

Credits

Props @dkotter, @jeffpaul

Checklist:

@dkotter dkotter added this to the 3.4.0 milestone Feb 28, 2025
@dkotter dkotter self-assigned this Feb 28, 2025
@dkotter dkotter requested review from jeffpaul and a team as code owners February 28, 2025 18:16
@github-actions github-actions bot added the needs:code-review This requires code review. label Feb 28, 2025
@dkotter dkotter requested review from iamdharmesh and removed request for a team and jeffpaul March 3, 2025 14:59
@jeffpaul
Copy link
Member

jeffpaul commented Mar 7, 2025

I imagine the primary experience for authors looking to utilize this sort of feature would be opening a new post and then triggering the Generate content button. The other option I wonder if its worth testing is a new + New > Post with AI in the adminbar, Posts > Add New Post with AI in the left menu, and/or a Create Post with AI command palette option that effectively dumps you into the editor with either the existing modal pre-displayed or even a Generate content block that has space for the prompt and then additional content generated renders as blocks with the additional Request changes / Start over options still within the Generate content block (so effectively the modal experience more injected into the editor directly).

As I tend to do on these sorts of things, sending up the 🦇🔦 (:batsignal:) for @fabiankaegy to see what he might recommend as well ;)

@dkotter
Copy link
Collaborator Author

dkotter commented Mar 7, 2025

For what it's worth, I did think through multiple options before landing on the UI as shown in this PR (not saying that means it's perfect but I didn't just randomly pick it). Summarized some of my quick thoughts on other approaches:

I initially thought of adding a new menu link (the same as the + New > Post with AI in the adminbar, Posts > Add New Post with AI in the left menu idea) that would take you to a unique experience that we fully control. Ultimately decided that using the normal block editor experience would be nicer and more consistent with the rest of WordPress. I do think we could add those links though and have that drop you into the normal editor with our UI already activated, though that could easily be a follow up to this PR (same with the "command palette option", though not sure how many people use that).

My next thought was to just use the normal editor with a button to trigger the process. Meaning someone would add a new post, add a title and then add their summary/bullet points/whatever in the normal block editor. Once ready, you'd click the button to start the process. My concern here was around discoverability. While it's fairly intuitive once you figure it out, it's not clear for new users how you'd go about initializing the process (also a little weird for existing posts that have content already).

I then thought of adding a new Content Generation block but had similar concerns here. Once you know the block exists and get used to that workflow it makes sense but for new users, not clear that you have to add that block to get started. The UX also gets a little weird if you happen to already have content in the editor and then you add that block, you end up having this conversation back and forth with AI in the block while still having other content outside of that. This is probably solvable with the right design but in quickly testing, was a little weird (also a little weird once you want to accept the AI content since you're technically already in the block editor and the content you add overwrites what's in the editor, so a little jarring for that block to disappear and you end up at the bottom of the content).

That's when I landed on the current approach, especially because it matches how the Generate Titles and Expand/Reduce Content Features already work (which gives us UX consistency). It's fairly clear how to initiate the process and everything is done within the modal, so doesn't matter if there's other content in the editor as that's all hidden while you iterate on things with the AI.

I'm happy to change approaches here if we think there's a better user experience to be had though, noting that the decision in #803 will probably impact some of the approach here (though we can always make updates after this is merged / prior to release instead of waiting on that PR to be fully complete)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-review This requires code review.
Projects
Status: Code Review
Development

Successfully merging this pull request may close these issues.

Generate draft post content from simple input
2 participants