Skip to content

Commit 67142f8

Browse files
committed
Merge branch 'main' into enhance_description
# Conflicts: # cmd/description/main.go
2 parents 78d2707 + 76855cf commit 67142f8

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

cmd/description/main.go

+4
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ func genCompletionOnce(ctx context.Context, client *oAIClient.Client, diff *gith
111111
Content: oAIClient.PromptDescribeChanges,
112112
})
113113
for _, file := range diff.Files {
114+
if file.Patch == nil {
115+
continue
116+
}
117+
114118
messages = append(messages, openai.ChatCompletionMessage{
115119
Role: openai.ChatMessageRoleUser,
116120
Content: *file.Patch,

cmd/review/main.go

+4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ func run(ctx context.Context) error {
6161
continue
6262
}
6363

64+
if file.Patch == nil {
65+
continue
66+
}
67+
6468
prompt := fmt.Sprintf(oAIClient.PromptReview, *file.Patch)
6569

6670
if len(prompt) > 4096 {

openai/openai.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
const (
1111
PromptDescribeChanges = "Bellow is the code patch, Generate a GitHub pull request description based on the following comments without basic prefix\n%s\n"
1212
PromptOverallDescribe = "Bellow comments are generated by AI, Generate a GitHub pull request description based on the following comments without basic prefix in markdown format with ### Description and ### Changes blocks:\n%s\n"
13-
PromptReview = "Bellow is the code patch, please help me do a brief code review,Answer me in English, if any bug risk and improvement suggestion are welcome\n%s\n"
14-
PromptOverallReview = "Bellow comments are generated by AI, please help me do a brief code review,Answer me in English, if any bug risk and improvement suggestion are welcome\n%s\n"
13+
PromptReview = "Bellow is the code patch, please help me do a brief code review, Answer me in English, if any bug risk and improvement suggestion are welcome\n%s\n"
14+
PromptOverallReview = "Bellow comments are generated by AI, please help me do a brief code review, Answer me in English, if any bug risk and improvement suggestion are welcome\n%s\n"
1515
)
1616

1717
type Client struct {

0 commit comments

Comments
 (0)