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: generate code suggestions via AI #90

Merged
merged 13 commits into from
May 23, 2023
Merged

Conversation

diivi
Copy link
Collaborator

@diivi diivi commented May 18, 2023

In action (except the duplicate buttons):
Peek 2023-05-18 23-20

I need to take care of some weird DOM-watching stuff; after that, this should be ready to merge.

The Generator button is disappearing randomly right now, maybe something to do with how the watcher is set up.

@diivi
Copy link
Collaborator Author

diivi commented May 18, 2023

image
lol it's the same issue I guess.

@diivi
Copy link
Collaborator Author

diivi commented May 19, 2023

This is 95% done, I am having just one issue though:

Sometimes the refactor button randomly disappears (it comes back after adding a new section or reloading).
Peek 2023-05-19 15-37

Like in the second review here ^

@diivi diivi marked this pull request as ready for review May 19, 2023 10:33
@diivi
Copy link
Collaborator Author

diivi commented May 19, 2023

Apparently, adding a delay to DOM manipulation did the trick. Maybe some small details can still be changed, but this should work overall (at least for single reviews).

@bdougie
Copy link
Member

bdougie commented May 19, 2023

I won't be able to review for another hour l. Can you a gif of this working with code.

@diivi
Copy link
Collaborator Author

diivi commented May 19, 2023

Here's a random sample generation (didn't verify if it's correct or not, but it does assist the reviewer):

Peek 2023-05-19 20-53

@bdougie
Copy link
Member

bdougie commented May 19, 2023

We can continue to develop this (in future prs). Doesn't have to be correct now, is the beauty of machine learning.

In a future PR, we can add a "was this helpful link" or similar 👍or👎buttons

@bdougie
Copy link
Member

bdougie commented May 21, 2023

I have tried testing this a few times and have not been able to even get the button to show.

Screen Shot 2023-05-20 at 5 19 40 PM

bdougie/bot-test-repo#480

@Anush008
Copy link
Member

It worked for me.
Untitled.png

@diivi
Copy link
Collaborator Author

diivi commented May 21, 2023

I have tried testing this a few times and have not been able to even get the button to show.

Maybe there's something wrong with the selectors? Can you confirm the js-suggestion-button-placeholder class exists on the change suggestion button?

image

@bdougie
Copy link
Member

bdougie commented May 21, 2023

Maybe there's something wrong with the selectors? Can you confirm the js-suggestion-button-placeholder class exists on the change suggestion button?

The class exists.

Screen Shot 2023-05-21 at 7 11 12 AM

@diivi
Copy link
Collaborator Author

diivi commented May 21, 2023

This is weird, what about inline-comments (on the comment box)?

@bdougie
Copy link
Member

bdougie commented May 21, 2023

@open-sauced/triage team, want to check this out and see if it works for you?

Copy link
Contributor

@a0m0rajab a0m0rajab left a comment

Choose a reason for hiding this comment

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

export const ChangeSuggestorButton = (commentNode: HTMLElement) => {
  const changeSuggestorButton = createHtmlElement("a", {
    innerHTML: `
      <span id="ai-change-gen" class="toolbar-item btn-octicon">
        <img class="octicon octicon-heading" height="16px" width="16px" id="ai-description-button-logo" src=${chrome.runtime.getURL(openSaucedLogoIcon)}>
      </span>
      <tool-tip for="ai-change-gen" class="sr-only" role="tooltip">Get Refactor Suggestions</tool-tip>
    `, being returned.ified the onclick event by removing the async/await as it doesn't seem necessary.
- Formatted the code for better readability.
Description generated using [OpenSauced](https://opensauced.ai/).
- Simpl
    onclick: () => handleSubmit(commentNode),
  });
  return changeSuggestorButton;
};
  • Added a return statement to the function to make it more clear what is

@a0m0rajab
Copy link
Contributor

a0m0rajab commented May 21, 2023

Worked on my PC.
I needed to hard refresh (CTRL+SHIFT+R) to get the OpenSauced icon.

Another example:
image

@diivi
Copy link
Collaborator Author

diivi commented May 22, 2023

@bdougie does hard refresh work for you? I have started working on the endpoint for this feature.

@bdougie
Copy link
Member

bdougie commented May 22, 2023

@bdougie does hard refresh work for you? I have started working on the endpoint for this feature.

No. I wonder if it is because I have another extension installed.

https://chrome.google.com/webstore/detail/gifs-for-github/dkgjnpbipbdaoaadbdhpiokaemhlphep

@diivi
Copy link
Collaborator Author

diivi commented May 22, 2023

No. I wonder if it is because I have another extension installed.

Did you try disabling the GIF extension once? If we decide that's the issue, maybe I can look at the conflict (shouldn't be important in that case though).

@takanome-dev
Copy link

Not working for me even after turning off all other extensions. There is only a div > button containing the suggested changes btn from GitHub inside div.js-suggestion-button-placeholder

pull-request-.100.open-sauced_ai.mp4

@diivi
Copy link
Collaborator Author

diivi commented May 22, 2023

Is there something relevant in the console? @takanome-dev

@takanome-dev
Copy link

Is there something relevant in the console? @takanome-dev

No, there is nothing in there 🤷‍♀️

@diivi
Copy link
Collaborator Author

diivi commented May 23, 2023

Super weird, I'm confused about how to debug this🤔 Can someone who can reproduce volunteer? I'm open for a discord call too.

@a0m0rajab
Copy link
Contributor

I tried the last updates, and it's not working right now, not sure how it worked before. @diivi I would love to have a call to debug it together.

@diivi
Copy link
Collaborator Author

diivi commented May 23, 2023

@a0m0rajab Right now, does the button appear for you? If it does, then it's fine, the suggestion won't appear for some time because the API endpoint is not live, so you'd be getting a 404 error.

If even the button does not appear, we can debug anytime you're free in the next 4 hours.

@a0m0rajab
Copy link
Contributor

Nope, even the button is not visible right now, I changed branches and it stopped working. (I could not make it appear even if I went back with commits)

@a0m0rajab a0m0rajab mentioned this pull request May 23, 2023
19 tasks
@diivi
Copy link
Collaborator Author

diivi commented May 23, 2023

@bdougie and @takanome-dev can you test if the button shows up now? The refactor might not work until we have the refactor endpoint in production on api.opensauced.pizza.

@bdougie
Copy link
Member

bdougie commented May 23, 2023

We will probably see it get released a little later today. @brandonroberts let us know when it goes live.

https://beta.api.opensauced.pizza/#/Pull%20Requests%20service/generateCodeRefactor

update: https://github.com/open-sauced/api.opensauced.pizza/pull/172

@bdougie
Copy link
Member

bdougie commented May 23, 2023

@bdougie and @takanome-dev can you test if the button shows up now? The refactor might not work until we have the refactor endpoint in production on api.opensauced.pizza.

The button now shows.

Screen Shot 2023-05-23 at 7 14 57 AM

@brandonroberts
Copy link

API release is merged, waiting on deployment

@brandonroberts
Copy link

API is deployed https://api.opensauced.pizza/#/Pull%20Requests%20service/generateCodeRefactor

@diivi diivi mentioned this pull request May 23, 2023
19 tasks
@diivi
Copy link
Collaborator Author

diivi commented May 23, 2023

@bdougie does it work for you?

@bdougie
Copy link
Member

bdougie commented May 23, 2023

Could you update the docs.opensauced.pizza to include steps on how to leverage this feature.

I think we are good to go.

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.

Look forward to shipping this live!

@diivi diivi mentioned this pull request May 23, 2023
5 tasks
@bdougie bdougie merged commit 14eede1 into beta May 23, 2023
3 checks passed
github-actions bot pushed a commit that referenced this pull request May 23, 2023
## [1.2.0-beta.3](v1.2.0-beta.2...v1.2.0-beta.3) (2023-05-23)

### 🍕 Features

* generate code suggestions via AI ([#90](#90)) ([14eede1](14eede1)), closes [#104](#104)
@github-actions
Copy link

🎉 This PR is included in version 1.2.0-beta.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@diivi diivi deleted the feat/generate-code-refactor branch May 23, 2023 17:59
@Anush008 Anush008 mentioned this pull request May 24, 2023
2 tasks
github-actions bot pushed a commit that referenced this pull request May 25, 2023
## [1.2.0](v1.1.0...v1.2.0) (2023-05-25)

### 🧑‍💻 Code Refactoring

* improved-extension-navigation ([#99](#99)) ([5b2f5c1](5b2f5c1))

### 📝 Documentation

* dev docs ([#83](#83)) ([4eff6eb](4eff6eb))

### 🐛 Bug Fixes

* adds demo to readme ([c27e614](c27e614))
* bump manifest version on main only ([#124](#124)) ([e4a86e4](e4a86e4))
* duplicate-button-injections using guards ([#110](#110)) ([3978766](3978766))

### 🍕 Features

* add PR velocity to profile page ([#111](#111)) ([ba7fad6](ba7fad6))
* generate code suggestions via AI ([#90](#90)) ([14eede1](14eede1)), closes [#104](#104)
* Manifest.json version bump ([#120](#120)) ([488046b](488046b))
* Resources page to link users to open-sauced feedback/discussions ([#100](#100)) ([3d607ae](3d607ae))
@github-actions
Copy link

🎉 This PR is included in version 1.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

zer0and1 pushed a commit to zer0and1/open-sauced.ai that referenced this pull request Jul 26, 2023
## [1.2.0-beta.3](open-sauced/ai@v1.2.0-beta.2...v1.2.0-beta.3) (2023-05-23)

### 🍕 Features

* generate code suggestions via AI ([#90](open-sauced/ai#90)) ([14eede1](open-sauced/ai@14eede1)), closes [#104](open-sauced/ai#104)
zer0and1 pushed a commit to zer0and1/open-sauced.ai that referenced this pull request Jul 26, 2023
## [1.2.0](open-sauced/ai@v1.1.0...v1.2.0) (2023-05-25)

### 🧑‍💻 Code Refactoring

* improved-extension-navigation ([#99](open-sauced/ai#99)) ([5b2f5c1](open-sauced/ai@5b2f5c1))

### 📝 Documentation

* dev docs ([#83](open-sauced/ai#83)) ([4eff6eb](open-sauced/ai@4eff6eb))

### 🐛 Bug Fixes

* adds demo to readme ([c27e614](open-sauced/ai@c27e614))
* bump manifest version on main only ([#124](open-sauced/ai#124)) ([e4a86e4](open-sauced/ai@e4a86e4))
* duplicate-button-injections using guards ([#110](open-sauced/ai#110)) ([3978766](open-sauced/ai@3978766))

### 🍕 Features

* add PR velocity to profile page ([#111](open-sauced/ai#111)) ([ba7fad6](open-sauced/ai@ba7fad6))
* generate code suggestions via AI ([#90](open-sauced/ai#90)) ([14eede1](open-sauced/ai@14eede1)), closes [#104](open-sauced/ai#104)
* Manifest.json version bump ([#120](open-sauced/ai#120)) ([488046b](open-sauced/ai@488046b))
* Resources page to link users to open-sauced feedback/discussions ([#100](open-sauced/ai#100)) ([3d607ae](open-sauced/ai@3d607ae))
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.

None yet

6 participants