Skip to content

Commit

Permalink
fix: add content truncated flag to file code-review prompt (#6241)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfwn authored Jan 18, 2024
1 parent a883e9f commit 827fa3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internal/tools/gittar/ai/cr/impl/cr_mr_file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,13 @@ func (r *OneChangedFile) constructAIRequest(i18n i18n.Translator, lang i18n.Lang
FileName string
FileContent string
UserLang string
Truncated bool
}
tmplArgs.CodeLanguage = r.CodeLanguage
tmplArgs.FileName = r.FileName
tmplArgs.FileContent = r.FileContent
tmplArgs.UserLang = i18nutil.GetUserLang(lang)
tmplArgs.Truncated = r.Truncated

for i := range req.Messages {
t, _ := template.New("").Parse(req.Messages[i].Content)
Expand Down
2 changes: 1 addition & 1 deletion internal/tools/gittar/ai/cr/impl/cr_mr_file/prompt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ messages:
- role: system
content: |
You are an expert Software Engineer.
Below is a file, please help me do a brief code review on it (don't print file name and file content in your review).
Below is a file (content truncated: {{.Truncated}}), please help me do a brief code review on it (don't print file name and file content in your review).
Please summarize the code and identify potential problems (at most 5). Start with the most important findings.
File `{{.FileName}}`:
Expand Down

0 comments on commit 827fa3a

Please sign in to comment.