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

feat: OpenSauced AI PR description #79

Merged
merged 25 commits into from
May 18, 2023
Merged

feat: OpenSauced AI PR description #79

merged 25 commits into from
May 18, 2023

Conversation

Anush008
Copy link
Member

@Anush008 Anush008 commented May 15, 2023

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation Update
  • 🎨 Style
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ”₯ Performance Improvements
  • βœ… Test
  • πŸ€– Build
  • πŸ” CI
  • πŸ“¦ Chore (Release)
  • ⏩ Revert

Description

This PR adds the AI PR description generation feature as suggested in #18. A new page is added to the extension dropdown to configure the description parameters. The text-generation is done using OpenAI's GPT-3.5 with the input context sourced from the code diff and/or the PR commits as configured by the user.
The feature documentation will be added to https://docs.opensauced.pizza.

Related Tickets & Documents

Resolves #18

Mobile & Desktop Screenshots/Recordings

Config window(This PR):
Untitled

Config window(New OpenSauced generation endpoint, #94):
Untitled

Generation demo:
test

Added tests?

  • πŸ‘ yes
  • πŸ™… no, because they aren't needed
  • πŸ™‹ no, because I need help

Added to documentation?

  • πŸ“œ README.md
  • πŸ““ docs.opensauced.pizza
  • πŸ• dev.to/opensauced
  • πŸ“• storybook
  • πŸ™… no documentation needed

200w.gif

@bdougie
Copy link
Member

bdougie commented May 15, 2023

The Spinaroonie is not included :( There'll be a drop-down.

I actually think we should ship with the spinner. We can make it spin when generate description is selected.

Also think we can make this available on all PRs.

I think a maintainer would find this useful for new contributors that don't leave descriptions.

We can leave a note that says:

description generated by OpenSauced

@bdougie
Copy link
Member

bdougie commented May 15, 2023

One thing I also noticed is that the icon does not show until you are logged in, but we should show even if you are not logged in, but instead log you in when it is clicked.

@Anush008
Copy link
Member Author

@bdougie Alright. I'll do that.

@bdougie
Copy link
Member

bdougie commented May 16, 2023

Sorry last thing. I think we don't need to ask for an OpenAi token and can provide to add to the build or env secrets at build time. The cost for OpenSauced will be negligible and we already spent time removing friction for login. To have OpenAi tokens as more friction, it is not ideal.

I will DM you a token to use.

Update: I invited you to the OpenSauced org on OpenAI.

@Anush008
Copy link
Member Author

Sorry last thing. I think we don't need to ask for an OpenAi token and can provide to add to the build or env secrets at build time. The cost for OpenSauced will be negligible and we already spent time removing friction for login. To have OpenAi tokens as more friction, it is not ideal.

The users can see the token in the extension's network tab when a completion request is made to v1/chat/completions. If the request will be done with our token, it has to be from the server-side with rate-limits on a per-account basis.

@bdougie
Copy link
Member

bdougie commented May 16, 2023

Ok let's keep it as is but make it serverside or Serverless function separately.

I have solutions but we can focus on making the feature work for now.

@diivi
Copy link
Contributor

diivi commented May 16, 2023

Yup, for what brian said to happen, we need to implement it as an opensauced API endpoint.

@bdougie
Copy link
Member

bdougie commented May 16, 2023

I know this is still in draft, but is this testable as of yet? It doesn't seem possible to save a token in the dropdown. Or at least I don't think I can confirm if it is saved.

@Anush008
Copy link
Member Author

I know this is still in draft, but is this testable as of yet? It doesn't seem possible to save a token in the dropdown. Or at least I don't think I can confirm if it is saved.

I am implementing the drop-down form right now to save the config data from the form.

@Anush008
Copy link
Member Author

Anush008 commented May 16, 2023

@bdougie, you can try the generation now. Currently it is implemented on the "Create a pull request page".
Work has to be done in styling, adding the button on "Edit PR" page, adding dropdowns and some fine tunings.

@bdougie
Copy link
Member

bdougie commented May 16, 2023

@bdougie, you can try the generation now. Currently it is implemented on the "Create a pull request page". Work has to done in styling, adding the button on "Edit PR" page, adding dropdowns and some fine tunings.

Just tried once and got this message.

Screen Shot 2023-05-16 at 12 23 21 PM Screen Shot 2023-05-16 at 12 23 26 PM

Copy link
Member

@bdougie bdougie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this from "AI PR Description" to "OpenSauced AI." This future proofs other AI features and we don't need to keep the scope to only PRs.

@Anush008 Anush008 changed the title feat: AI powered PR description feat: OpenSauced AI May 17, 2023
Copy link
Member

@bdougie bdougie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as everything I pointed out has been addressed. @diivi brought up some valid questions and thoughts about console.error and alerts.

We should alert to assist the user journey and use the console for error messages for the developer. Let's address those, so we can merge this.

I would love to get this in @BekahHW's newsletter on Monday and @brandonroberts will assist with adding an endpoint for OpenAI so we can remove that interaction.

@Anush008 Anush008 changed the title feat: OpenSauced AI feat: OpenSauced AI PR description May 17, 2023
@bdougie bdougie marked this pull request as ready for review May 17, 2023 21:31
@bdougie bdougie mentioned this pull request May 17, 2023
2 tasks
@Anush008
Copy link
Member Author

There's an issue I bumped into while adding the button to the "Edit PR" section.
Unlike the "Create new PR" page, the PR page doesn't seem to have the comment editor as a part of the initial HTML when page loads. It is rendered when we click "edit" button.
We'll have to use MutationObserver to listen for changes and then add the button.

@bdougie
Copy link
Member

bdougie commented May 18, 2023

Seems like a reasonable solution.

@Anush008
Copy link
Member Author

In case of draft PRs, the
https://api.github.com/repos/owner-name/repo-name/pulls/79 endpoint returns the number of commits instead of an array of commit objects with the commit messages. So, draft PR's can't use commit messages as a source for the description.
https://github.com/open-sauced/browser-extensions/blob/22b243be07ac5e4020efc5e7ba7335a9ff36b0ab/src/utils/fetchGithubAPIData.ts#L25

@bdougie
Copy link
Member

bdougie commented May 18, 2023

Could we disable the button with a tooltip on hover that says, "unavailable for draft prs"

I was going to ask if you were going to use the feature to generate your description. That is the real test.

@Anush008
Copy link
Member Author

But the diff is available. The commit messages are not.

@bdougie
Copy link
Member

bdougie commented May 18, 2023

But the diff is available. The commit messages are not.

Of we can just go with diff. No need for an explanation. We can just handle it behind the scenes.

@bdougie bdougie merged commit 0e38777 into beta May 18, 2023
github-actions bot pushed a commit that referenced this pull request May 18, 2023
## [1.1.0-beta.4](v1.1.0-beta.3...v1.1.0-beta.4) (2023-05-18)

### πŸ• Features

* OpenSauced AI PR description  ([#79](#79)) ([0e38777](0e38777))
@github-actions
Copy link

πŸŽ‰ This PR is included in version 1.1.0-beta.4 πŸŽ‰

The release is available on GitHub release

Your semantic-release bot πŸ“¦πŸš€

@Anush008 Anush008 deleted the ai-powered-highlights branch May 18, 2023 17:22
github-actions bot pushed a commit that referenced this pull request May 20, 2023
## [1.1.0](v1.0.0...v1.1.0) (2023-05-20)

### πŸ“ Documentation

* how we create extension releases ([#81](#81)) ([10b1c48](10b1c48))

### πŸ› Bug Fixes

* add extra line and italics ([#93](#93)) ([2cbd790](2cbd790))
* update name in README ([dba4734](dba4734))

### πŸ• Features

* add/remove repos to/from insights. ([#77](#77)) ([8e4a6ed](8e4a6ed))
* OpenSauced AI PR description  ([#79](#79)) ([0e38777](0e38777))
* replace open issues count with highlights count ([#76](#76)) ([0fb8149](0fb8149))
* Updated to the new AI PR description endpoint ([#94](#94)) ([cf8f64c](cf8f64c))
@github-actions
Copy link

πŸŽ‰ This PR is included in version 1.1.0 πŸŽ‰

The release is available on GitHub release

Your semantic-release bot πŸ“¦πŸš€

zer0and1 added a commit to zer0and1/open-sauced.ai that referenced this pull request Jul 26, 2023
## [1.1.0-beta.4](open-sauced/ai@v1.1.0-beta.3...v1.1.0-beta.4) (2023-05-18)

### πŸ• Features

* OpenSauced AI PR description  ([#79](open-sauced/ai#79)) ([0e38777](open-sauced/ai@0e38777))
zer0and1 pushed a commit to zer0and1/open-sauced.ai that referenced this pull request Jul 26, 2023
## [1.1.0](open-sauced/ai@v1.0.0...v1.1.0) (2023-05-20)

### πŸ“ Documentation

* how we create extension releases ([#81](open-sauced/ai#81)) ([10b1c48](open-sauced/ai@10b1c48))

### πŸ› Bug Fixes

* add extra line and italics ([#93](open-sauced/ai#93)) ([2cbd790](open-sauced/ai@2cbd790))
* update name in README ([dba4734](open-sauced/ai@dba4734))

### πŸ• Features

* add/remove repos to/from insights. ([#77](open-sauced/ai#77)) ([8e4a6ed](open-sauced/ai@8e4a6ed))
* OpenSauced AI PR description  ([#79](open-sauced/ai#79)) ([0e38777](open-sauced/ai@0e38777))
* replace open issues count with highlights count ([#76](open-sauced/ai#76)) ([0fb8149](open-sauced/ai@0fb8149))
* Updated to the new AI PR description endpoint ([#94](open-sauced/ai#94)) ([cf8f64c](open-sauced/ai@cf8f64c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Generate pull request descriptions with AI
3 participants