Skip to content

Commit

Permalink
send raw_summary in comments (coderabbitai#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
harjotgill authored Apr 27, 2023
1 parent 63e6c4e commit 68111de
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 26 deletions.
19 changes: 8 additions & 11 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions src/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export class Inputs {
title: string
description: string
rawSummary: string
releaseNotes: string
filename: string
fileContent: string
fileDiff: string
Expand All @@ -17,7 +16,6 @@ export class Inputs {
title = 'no title provided',
description = 'no description provided',
rawSummary = '',
releaseNotes = '',
filename = '',
fileContent = 'file contents cannot be provided',
fileDiff = 'file diff cannot be provided',
Expand All @@ -30,7 +28,6 @@ export class Inputs {
this.title = title
this.description = description
this.rawSummary = rawSummary
this.releaseNotes = releaseNotes
this.filename = filename
this.fileContent = fileContent
this.fileDiff = fileDiff
Expand All @@ -46,7 +43,6 @@ export class Inputs {
this.title,
this.description,
this.rawSummary,
this.releaseNotes,
this.filename,
this.fileContent,
this.fileDiff,
Expand All @@ -73,9 +69,6 @@ export class Inputs {
if (this.rawSummary) {
content = content.replace('$raw_summary', this.rawSummary)
}
if (this.releaseNotes) {
content = content.replace('$release_notes', this.releaseNotes)
}
if (this.filename) {
content = content.replace('$filename', this.filename)
}
Expand Down
2 changes: 1 addition & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class Options {
openaiRetries = '3',
openaiTimeoutMS = '120000',
openaiConcurrencyLimit = '4',
apiBaseUrl = "https://api.openai.com/v1"
apiBaseUrl = 'https://api.openai.com/v1'
) {
this.debug = debug
this.disableReview = disableReview
Expand Down
5 changes: 5 additions & 0 deletions src/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ Description:
$description
\`\`\`
OpenAI generated summary:
\`\`\`
$raw_summary
\`\`\`
Content of file prior to changes:
\`\`\`
$file_content
Expand Down
3 changes: 0 additions & 3 deletions src/review-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ export const handleReviewComment = async (
inputs.description = commenter.getDescription(
context.payload.pull_request.body
)
inputs.releaseNotes = commenter.getReleaseNotes(
context.payload.pull_request.body
)
}

// check if the comment was created and not edited or deleted
Expand Down
4 changes: 0 additions & 4 deletions src/review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ export const codeReview = async (
inputs.description = commenter.getDescription(
context.payload.pull_request.body
)
inputs.releaseNotes = commenter.getReleaseNotes(
context.payload.pull_request.body
)
}

// if the description contains ignore_keyword, skip
Expand Down Expand Up @@ -390,7 +387,6 @@ ${filename}: ${summary}
info('release notes: nothing obtained from openai')
} else {
nextSummarizeIds = releaseNotesIds
inputs.releaseNotes = releaseNotesResponse.replace(/(^|\n)> .*/g, '')
let message = '### Summary by OpenAI\n\n'
message += releaseNotesResponse
try {
Expand Down

0 comments on commit 68111de

Please sign in to comment.