Skip to content

Commit 12de0e8

Browse files
committed
file is null causing fail, if null skipping file
1 parent c487865 commit 12de0e8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

cmd/description/main.go

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ func run(ctx context.Context) error {
5757
var OverallDescribeCompletion string
5858
OverallDescribeCompletion += fmt.Sprintf("Pull request title: %s, body: %s\n\n", pr.GetTitle(), pr.GetBody())
5959
for _, file := range diff.Files {
60+
61+
if file.Patch == nil {
62+
continue
63+
}
64+
6065
prompt := fmt.Sprintf(oAIClient.PromptDescribeChanges, *file.Patch)
6166

6267
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)