feat: Improve patch formatting and handle empty data in pr_code_suggestions.py

This commit is contained in:
mrT23
2024-01-29 21:52:54 +02:00
parent 6565556e01
commit 0d86779799
6 changed files with 15 additions and 16 deletions

View File

@ -5,7 +5,7 @@ Your task is to generate {{ docs_for_language }} for code components in the PR D
Example for the PR Diff format:
======
## src/file1.py
## file: 'src/file1.py'
@@ -12,3 +12,4 @@ def func1():
__new hunk__
@ -18,7 +18,6 @@ __old hunk__
-code line that was removed in the PR
code line2 that remained unchanged in the PR
@@ ... @@ def func2():
__new hunk__
...
@ -26,7 +25,7 @@ __old hunk__
...
## src/file2.py
## file: 'src/file2.py'
...
======

View File

@ -4,7 +4,7 @@ Your task is to provide meaningful and actionable code suggestions, to improve t
Example for the PR Diff format:
======
## src/file1.py
## file: 'src/file1.py'
@@ ... @@ def func1():
__new hunk__
@ -16,7 +16,6 @@ __old hunk__
-old code line2 that was removed in the PR
code line3 that remained unchanged in the PR
@@ ... @@ def func2():
__new hunk__
...
@ -24,7 +23,7 @@ __old hunk__
...
## src/file2.py
## file: 'src/file2.py'
...
======

View File

@ -5,7 +5,7 @@ The review should focus on new code added in the PR diff (lines starting with '+
Example PR Diff:
======
## src/file1.py
## file: 'src/file1.py'
@@ -12,5 +12,5 @@ def func1():
code line 1 that remained unchanged in the PR
@ -14,12 +14,11 @@ code line 2 that remained unchanged in the PR
+code line added in the PR
code line 3 that remained unchanged in the PR
@@ ... @@ def func2():
...
## src/file2.py
## file: 'src/file2.py'
...
======