Refactor pr_code_suggestions logic and update prompts for clarity and consistency

This commit is contained in:
mrT23
2024-05-13 18:03:13 +03:00
parent 6c0837491c
commit 95c7b3f55c
3 changed files with 27 additions and 41 deletions

View File

@ -46,9 +46,7 @@ __old hunk__
The output must be a YAML object equivalent to type $PRCodeSuggestionsFeedback, according to the following Pydantic definitions:
=====
class CodeSuggestionFeedback(BaseModel):
{%- if not commitable_code_suggestions_mode %}
suggestion_summary: str = Field(description="repeated from the input")
{%- endif %}
relevant_file: str = Field(description="repeated from the input")
suggestion_score: int = Field(description="The actual output - the score of the suggestion, from 0 to 10. Give 0 if the suggestion is plain wrong. Otherwise, give a score from 1 to 10 (inclusive), where 1 is the lowest and 10 is the highest.")
why: str = Field(description="Short and concise explanation of why the suggestion received the score (one to two sentences).")
@ -61,13 +59,9 @@ class PRCodeSuggestionsFeedback(BaseModel):
Example output:
```yaml
code_suggestions:
{%- if not commitable_code_suggestions_mode %}
- suggestion_content: |
Use a more descriptive variable name here
relevant_file: "src/file1.py"
{%- else %}
- relevant_file: "src/file1.py"
{%- endif %}
suggestion_score: 6
why: |
The variable name 't' is not descriptive enough