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

Commit 4cd5ad7

Browse files
authored
refactor prompt (#248)
<!-- This is an auto-generated comment: release notes by openai --> ### Summary by OpenAI ### Release Notes - Refactor: Improve summarization output by removing default prompt and adding summary prefix. ### Poem > Summarizing text with ease, 📝 > > Our code now aims to please. 💻 > > With prompts refactored and improved, 🆕 > > Our users' needs are better soothed. 🤗 <!-- end of auto-generated comment: release notes by openai -->
1 parent 28624a8 commit 4cd5ad7

File tree

3 files changed

+124
-123
lines changed

3 files changed

+124
-123
lines changed

action.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@ inputs:
112112
required: false
113113
description: 'The prompt for final summarization response'
114114
default: |
115-
Here is the summary of changes you have generated for files:
116-
```
117-
$raw_summary
118-
```
119-
120115
Provide your final response in the `markdown` format with
121116
the following content:
122117
- High-level summary (comment on the overall change instead of

dist/index.js

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

src/prompts.ts

Lines changed: 63 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ Description:
1212
$description
1313
\`\`\`
1414
15-
Content of file \`$filename\` prior to changes:
16-
\`\`\`
17-
$file_content
18-
\`\`\`
19-
2015
Diff:
2116
\`\`\`diff
2217
$file_diff
@@ -53,61 +48,13 @@ changesets using the same format as the input.
5348
$raw_summary
5449
`
5550

56-
comment = `A comment was made on a GitHub pull request review for a
57-
diff hunk on file \`$filename\`. I would like you to follow
58-
the instructions in that comment.
59-
60-
Pull request title:
61-
\`$title\`
62-
63-
Description:
64-
\`\`\`
65-
$description
66-
\`\`\`
67-
68-
OpenAI generated notes:
69-
\`\`\`
70-
$release_notes
71-
\`\`\`
72-
73-
Content of file prior to changes:
74-
\`\`\`
75-
$file_content
76-
\`\`\`
77-
78-
Entire diff:
79-
\`\`\`diff
80-
$file_diff
81-
\`\`\`
82-
83-
Diff being commented on:
84-
\`\`\`diff
85-
$diff
86-
\`\`\`
51+
summarizePrefix = `Here is the summary of changes you have generated for files:
52+
\`\`\`
53+
$raw_summary
54+
\`\`\`
8755
88-
The format of a comment in the chain is:
89-
\`user: comment\`
90-
91-
Comment chain (including the new comment):
92-
\`\`\`
93-
$comment_chain
94-
\`\`\`
95-
96-
Please reply directly to the new comment (instead of suggesting
97-
a reply) and your reply will be posted as-is.
98-
99-
If the comment contains instructions/requests for you, please comply.
100-
For example, if the comment is asking you to generate documentation
101-
comments on the code, in your reply please generate the required code.
102-
103-
In your reply, please make sure to begin the reply by tagging the user
104-
with "@user".
105-
106-
The comment/request that you need to directly reply to:
107-
\`\`\`
108-
$comment
109-
\`\`\`
11056
`
57+
11158
reviewFileDiff = `GitHub pull request title:
11259
\`$title\`
11360
@@ -237,6 +184,62 @@ Example response:
237184
238185
Changes for review are below:
239186
$patches
187+
`
188+
189+
comment = `A comment was made on a GitHub pull request review for a
190+
diff hunk on file \`$filename\`. I would like you to follow
191+
the instructions in that comment.
192+
193+
Pull request title:
194+
\`$title\`
195+
196+
Description:
197+
\`\`\`
198+
$description
199+
\`\`\`
200+
201+
OpenAI generated notes:
202+
\`\`\`
203+
$release_notes
204+
\`\`\`
205+
206+
Content of file prior to changes:
207+
\`\`\`
208+
$file_content
209+
\`\`\`
210+
211+
Entire diff:
212+
\`\`\`diff
213+
$file_diff
214+
\`\`\`
215+
216+
Diff being commented on:
217+
\`\`\`diff
218+
$diff
219+
\`\`\`
220+
221+
The format of a comment in the chain is:
222+
\`user: comment\`
223+
224+
Comment chain (including the new comment):
225+
\`\`\`
226+
$comment_chain
227+
\`\`\`
228+
229+
Please reply directly to the new comment (instead of suggesting
230+
a reply) and your reply will be posted as-is.
231+
232+
If the comment contains instructions/requests for you, please comply.
233+
For example, if the comment is asking you to generate documentation
234+
comments on the code, in your reply please generate the required code.
235+
236+
In your reply, please make sure to begin the reply by tagging the user
237+
with "@user".
238+
239+
The comment/request that you need to directly reply to:
240+
\`\`\`
241+
$comment
242+
\`\`\`
240243
`
241244

242245
constructor(summarize = '', summarizeReleaseNotes = '') {
@@ -260,7 +263,8 @@ $patches
260263
}
261264

262265
renderSummarize(inputs: Inputs): string {
263-
return inputs.render(this.summarize)
266+
const prompt = this.summarizePrefix + this.summarize
267+
return inputs.render(prompt)
264268
}
265269

266270
renderSummarizeReleaseNotes(inputs: Inputs): string {

0 commit comments

Comments
 (0)