mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-02 11:50:37 +08:00
Merge remote-tracking branch 'origin/enhancment/markdown' into feature/github_tag_improve
This commit is contained in:
@ -51,9 +51,13 @@ def parse_code_suggestion(code_suggestions: dict) -> str:
|
|||||||
markdown_text += f" - **{code_key}:**\n{code_str_indented}\n"
|
markdown_text += f" - **{code_key}:**\n{code_str_indented}\n"
|
||||||
else:
|
else:
|
||||||
if "suggestion number" in sub_key.lower():
|
if "suggestion number" in sub_key.lower():
|
||||||
markdown_text += f"- **suggestion {sub_value}:**\n" # prettier formatting
|
# markdown_text += f"- **suggestion {sub_value}:**\n" # prettier formatting
|
||||||
|
pass
|
||||||
|
elif "relevant file" in sub_key.lower():
|
||||||
|
markdown_text += f"\n - **{sub_key}:** {sub_value}\n"
|
||||||
else:
|
else:
|
||||||
markdown_text += f" - **{sub_key}:** {sub_value}\n"
|
markdown_text += f" **{sub_key}:** {sub_value}\n"
|
||||||
|
|
||||||
markdown_text += "\n"
|
markdown_text += "\n"
|
||||||
return markdown_text
|
return markdown_text
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ system="""You are CodiumAI-PR-Reviewer, a language model designed to review git
|
|||||||
Your task is to answer questions about the new PR code (the '+' lines), and provide feedback.
|
Your task is to answer questions about the new PR code (the '+' lines), and provide feedback.
|
||||||
Be informative, constructive, and give examples. Try to be as specific as possible, and don't avoid answering the questions.
|
Be informative, constructive, and give examples. Try to be as specific as possible, and don't avoid answering the questions.
|
||||||
Make sure not to repeat modifications already implemented in the new PR code (the '+' lines).
|
Make sure not to repeat modifications already implemented in the new PR code (the '+' lines).
|
||||||
|
Answer only the questions, and don't add unrelated content.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
user="""PR Info:
|
user="""PR Info:
|
||||||
|
@ -33,7 +33,7 @@ You must use the following JSON schema to format your answer:
|
|||||||
{%- if require_minimal_and_focused %}
|
{%- if require_minimal_and_focused %}
|
||||||
"Minimal and focused": {
|
"Minimal and focused": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "is this PR as minimal and focused as possible, with all code changes centered around a single coherent theme, described in the PR description and title ?" explain your answer"
|
"description": "is this PR as minimal and focused as possible, with all code changes centered around a single coherent theme, described in the PR description and title ?" Make sure to explain your answer"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
@ -107,7 +107,7 @@ Example output:
|
|||||||
"Relevant tests added": "No",
|
"Relevant tests added": "No",
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if require_minimal_and_focused %}
|
{%- if require_minimal_and_focused %}
|
||||||
"Minimal and focused": "No, because ..."
|
"Minimal and focused": "yes\\no, because ..."
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
},
|
},
|
||||||
"PR Feedback":
|
"PR Feedback":
|
||||||
|
@ -64,6 +64,8 @@ class PRQuestions:
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
def _prepare_pr_answer(self) -> str:
|
def _prepare_pr_answer(self) -> str:
|
||||||
answer_str = f"Questions: {self.question_str}\n\n"
|
answer_str = f"Question: {self.question_str}\n\n"
|
||||||
answer_str += f"Answer: {self.prediction.strip()}\n\n"
|
answer_str += f"Answer: {self.prediction.strip()}\n\n"
|
||||||
|
if settings.config.verbosity_level >= 2:
|
||||||
|
logging.info(f"answer_str:\n{answer_str}")
|
||||||
return answer_str
|
return answer_str
|
||||||
|
@ -81,6 +81,14 @@ class PRReviewer:
|
|||||||
except json.decoder.JSONDecodeError:
|
except json.decoder.JSONDecodeError:
|
||||||
logging.error("Unable to decode JSON response from AI")
|
logging.error("Unable to decode JSON response from AI")
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
|
# reordering for nicer display
|
||||||
|
if 'PR Feedback' in data:
|
||||||
|
if 'Security concerns' in data['PR Feedback']:
|
||||||
|
val = data['PR Feedback']['Security concerns']
|
||||||
|
del data['PR Feedback']['Security concerns']
|
||||||
|
data['PR Analysis']['Security concerns'] = val
|
||||||
|
|
||||||
markdown_text = convert_to_markdown(data)
|
markdown_text = convert_to_markdown(data)
|
||||||
user = self.git_provider.get_user_id()
|
user = self.git_provider.get_user_id()
|
||||||
markdown_text += "\n### How to use\n"
|
markdown_text += "\n### How to use\n"
|
||||||
|
Reference in New Issue
Block a user