Skip to content

Commit

Permalink
feat: testing different prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuel-braz committed Nov 10, 2023
1 parent f7e89f5 commit f89bfdd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/code-review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ jobs:
max_tokens: 900
exclude: "**/*.json, **/*.md, **/*.g.dart"
append_prompt: |
- Give a minimum of 0 suggestions and a maximum of 5 suggestions.
- Translate the comment in all "reviewComment" properties to portuguese (pt-br).
- Give a maximum of 4 suggestions
- Do not suggest code formatting issues.
- Do not suggest imports issues.
12 changes: 6 additions & 6 deletions code-review/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ async function analyzeCode(parsedDiff, prDetails) {
for (const file of parsedDiff) {
if (file.to === "/dev/null") continue; // Ignore deleted files
for (const chunk of file.chunks) {
logger.log(`Analyzing chunk: ${chunk.changes}\n------------------`);
const messages = createMessages(file, chunk, prDetails);
const aiResponse = await getAIResponse(messages);
if (aiResponse) {
Expand All @@ -79,13 +80,12 @@ function createMessages(file, chunk, prDetails) {
const instructionJsonFormat = `- Always provide the response in following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]`;

var contentSystemMessage = `You are a senior software engineer and your task is to review pull requests for possible bugs or bad development practices. Follow the instructions below:
- You should never give positive comments or compliments.
- You should never suggest removing empty line.
- You should not suggest adding a new line at the end of the file.
- You should never suggest to remove trailing or leading whitespace.
- You should never suggest adding comment to code.
- Avoid giving an excessive amount of suggestions for a single file. Prioritize the most important suggestions.
- You will provide suggestions only if there is possible issues or bugs in the code, otherwise return an empty array.
- Do not give positive comments or compliments.
- Don't suggest removing empty line or adding line to end of file
- Don't suggest to remove trailing or leading whitespace.
- Don't suggest to remove the spaces.
- Don't suggest adding comment to code.
- Do use the given pull request title and description only for the overall context and only comment the code.`;

if (overridePrompt) {
Expand Down

0 comments on commit f89bfdd

Please sign in to comment.