mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-05 05:10:38 +08:00
improve code suggestion prompt
This commit is contained in:
@ -101,11 +101,11 @@ def process_patch_lines(patch_str, original_file_str, patch_extra_lines_before,
|
|||||||
# Update start and size in one line each
|
# Update start and size in one line each
|
||||||
extended_start1, extended_start2 = extended_start1 + i, extended_start2 + i
|
extended_start1, extended_start2 = extended_start1 + i, extended_start2 + i
|
||||||
extended_size1, extended_size2 = extended_size1 - i, extended_size2 - i
|
extended_size1, extended_size2 = extended_size1 - i, extended_size2 - i
|
||||||
get_logger().debug(f"Found section header in line {i} before the hunk")
|
# get_logger().debug(f"Found section header in line {i} before the hunk")
|
||||||
section_header = ''
|
section_header = ''
|
||||||
break
|
break
|
||||||
if not found_header:
|
if not found_header:
|
||||||
get_logger().debug(f"Section header not found in the extra lines before the hunk")
|
# get_logger().debug(f"Section header not found in the extra lines before the hunk")
|
||||||
extended_start1, extended_size1, extended_start2, extended_size2 = \
|
extended_start1, extended_size1, extended_start2, extended_size2 = \
|
||||||
_calc_context_limits(patch_extra_lines_before)
|
_calc_context_limits(patch_extra_lines_before)
|
||||||
else:
|
else:
|
||||||
|
@ -75,7 +75,7 @@ class CodeSuggestionFeedback(BaseModel):
|
|||||||
suggestion_summary: str = Field(description="Repeated from the input")
|
suggestion_summary: str = Field(description="Repeated from the input")
|
||||||
relevant_file: str = Field(description="Repeated from the input")
|
relevant_file: str = Field(description="Repeated from the input")
|
||||||
suggestion_score: int = Field(description="Evaluate the suggestion and assign a score from 0 to 10. Give 0 if the suggestion is wrong. For valid suggestions, score from 1 (lowest impact/importance) to 10 (highest impact/importance).")
|
suggestion_score: int = Field(description="Evaluate the suggestion and assign a score from 0 to 10. Give 0 if the suggestion is wrong. For valid suggestions, score from 1 (lowest impact/importance) to 10 (highest impact/importance).")
|
||||||
why: str = Field(description="Briefly justify the score in 1-2 sentences, focusing on the suggestion's impact, relevance, and accuracy.")
|
why: str = Field(description="Briefly explain the score given in 1-2 sentences, focusing on the suggestion's impact, relevance, and accuracy.")
|
||||||
|
|
||||||
class PRCodeSuggestionsFeedback(BaseModel):
|
class PRCodeSuggestionsFeedback(BaseModel):
|
||||||
code_suggestions: List[CodeSuggestionFeedback]
|
code_suggestions: List[CodeSuggestionFeedback]
|
||||||
|
Reference in New Issue
Block a user