pr-codex icon indicating copy to clipboard operation
pr-codex copied to clipboard

PR-Codex init

Open jjranalli opened this issue 2 years ago • 4 comments

This is PR-Codex in action


PR-Codex overview

This PR adds a new feature to the project: a GitHub app that explains and summarizes PR code diffs. It includes a new github/route.ts file and updates several existing files, including README.md, Homepage.tsx, DefaultHead.tsx, AppLayout.tsx, Footer.tsx, and Navbar.tsx.

Detailed summary

  • Adds new github/route.ts file
  • Updates README.md
  • Updates Homepage.tsx
  • Updates DefaultHead.tsx
  • Updates AppLayout.tsx
  • Updates Footer.tsx
  • Updates Navbar.tsx

The following files were skipped due to too many changes: lib/summarizePullRequest.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

jjranalli avatar Mar 16 '23 13:03 jjranalli

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
pr-codex ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 18, 2023 11:27am

vercel[bot] avatar Mar 16 '23 13:03 vercel[bot]

/codex how does the logic of generating replies from comments work?

jjranalli avatar Apr 17 '23 00:04 jjranalli

how does the logic of generating replies from comments work?

@jjranalli When a comment is created on a pull request with the text /ask-codex, the replyIssueComment function is triggered. It first extracts the relevant information from the payload, such as the repository, issue, sender, and comment. Then it gets the diff content using the getCodeDiff function, which retrieves the diff of the pull request using the GitHub API.

If there are changes in the diff, generateChatGpt is called with a system prompt and the code diff as messages. generateChatGpt uses OpenAI's GPT-3 API to generate a response to the question asked in the comment.

Finally, the response is formatted as a comment and posted back to the pull request as a reply to the original comment. In addition, if there are skipped files or if the code diff exceeds the maximum character limit, this information is appended to the response.

pr-codex[bot] avatar Apr 17 '23 00:04 pr-codex[bot]

explain this

@jjranalli The code diff shows a series of modifications made to various files in a project, primarily related to handling GitHub pull requests and comments through a Git diff assistant. Below is a summary of the key changes:

  1. File Deletion:

    • The file utils/github/testPayload.tsREADME.md has been deleted.
  2. New Imports and Constants:

    • New constants and imports have been introduced in several files, such as testPayloadComment in utils/github/testPayloadComment.ts and generateChatGpt in lib/replyIssueComment.ts.
  3. Changes in utils/parseDiff.ts:

    • Modifications include:
      • Changing the variable from combinedString to codeDiff.
      • Returning an object containing codeDiff and maxLengthExceeded instead of just combinedString.
      • Adding logic to handle deleted files.
  4. Updates in scripts/summarize.ts:

    • The import statement for testPayload has been replaced with testPayloadSyncPr.
    • Corresponding changes in function calls to use the new payload.
  5. Enhancements in app/github/route.ts:

    • Added logic to respond to comments created on pull requests, specifically if they contain the command /ask-codex.
  6. New Functionality in utils/getCodeDiff.ts:

    • A new function getCodeDiff has been added to fetch and parse the diff content from GitHub pull requests.
  7. New File utils/github/testPayloadSyncPr.ts:

    • This file includes a new payload structure for handling synchronized pull requests.
  8. New Functionality in lib/replyIssueComment.ts:

    • A function to reply to issue comments based on the content of the comments and the associated pull request.
  9. Changes in lib/summarizePullRequest.ts:

    • The structure of the function has been updated to improve how summaries are generated from pull request diffs.

Overall, the changes enhance the functionality of the application to better handle GitHub pull requests, summarize changes, and respond to comments, providing a more interactive experience for users interacting with pull requests.

pr-codex[bot] avatar Sep 23 '24 10:09 pr-codex[bot]