Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit c54d3f3

Browse files
authored
small batches for summarization (#245)
<!-- This is an auto-generated comment: release notes by openai --> ### Summary by OpenAI Release Notes: - Performance: Default timeout for OpenAI API calls reduced from 180000 to 120000 milliseconds. Batch size used for summarizing files in `review.ts` changed from 20 to 10. - User Experience: Added instructions and context to the review process in `prompts.ts`. > "Code quality improved, > Performance enhanced, > Review process streamlined, > Our codebase now advanced." <!-- end of auto-generated comment: release notes by openai -->
1 parent 560d3a2 commit c54d3f3

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ inputs:
7979
openai_timeout_ms:
8080
required: false
8181
description: 'Timeout for OpenAI API call in millis'
82-
default: '180000'
82+
default: '120000'
8383
openai_concurrency_limit:
8484
required: false
8585
description: 'How many concurrent API calls to make to OpenAI servers?'

dist/index.js

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/prompts.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,10 @@ Instructions:
155155
\`<line_number><colon><whitespace>\`.
156156
- Your task is to review ONLY the new hunks line by line, ONLY pointing out
157157
substantive issues within line number ranges. Provide the exact line
158-
number range (inclusive) for each issue. Focus on identifying specific
159-
issues and avoid summarizing changes or providing general feedback.
158+
number range (inclusive) for each issue. Consider additional context
159+
provided by old hunks, comment chains and the file content while
160+
reviewing the new hunks. Focus on identifying specific issues and
161+
avoid summarizing changes or providing general feedback.
160162
- IMPORTANT: Respond only in the response format (consisting of review
161163
sections). Each review section must have a line number range and a review
162164
comment for that range. Do not include general feedback or summaries. You

src/review.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,11 @@ ${hunks.oldHunk}
346346
) as Array<[string, string, boolean]>
347347

348348
if (summaries.length > 0) {
349-
// join summaries into one in the batches of 20
349+
const batchSize = 10
350+
// join summaries into one in the batches of batchSize
350351
// and ask the bot to summarize the summaries
351-
for (let i = 0; i < summaries.length; i += 20) {
352-
const summariesBatch = summaries.slice(i, i + 20)
352+
for (let i = 0; i < summaries.length; i += batchSize) {
353+
const summariesBatch = summaries.slice(i, i + batchSize)
353354
for (const [filename, summary] of summariesBatch) {
354355
inputs.rawSummary += `---
355356
${filename}: ${summary}

0 commit comments

Comments
 (0)