Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #6241: fix(gittar): add content truncated flag to file code-review prompt #6243

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading