mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-02 11:50:37 +08:00
removed include_improved_code
This commit is contained in:
@ -51,7 +51,6 @@ To edit [configurations](./../pr_agent/settings/configuration.toml#L66) related
|
||||
- `num_code_suggestions`: number of code suggestions provided by the 'improve' tool. Default is 4.
|
||||
- `extra_instructions`: Optional extra instructions to the tool. For example: "focus on the changes in the file X. Ignore change in ...".
|
||||
- `rank_suggestions`: if set to true, the tool will rank the suggestions, based on importance. Default is false.
|
||||
- `include_improved_code`: if set to true, the tool will include an improved code implementation in the suggestion. Default is true.
|
||||
- `summarize`: if set to true, the tool will display the suggestions in a single comment. Default is false.
|
||||
- `enable_help_text`: if set to true, the tool will display a help text in the comment. Default is true.
|
||||
#### params for '/improve --extended' mode
|
||||
|
@ -69,8 +69,7 @@ enable_help_text=true
|
||||
|
||||
[pr_code_suggestions] # /improve #
|
||||
num_code_suggestions=4
|
||||
summarize = false
|
||||
include_improved_code = true
|
||||
summarize = true
|
||||
extra_instructions = ""
|
||||
rank_suggestions = false
|
||||
enable_help_text=true
|
||||
|
@ -169,35 +169,19 @@ class PRCodeSuggestions:
|
||||
if new_code_snippet:
|
||||
new_code_snippet = self.dedent_code(relevant_file, relevant_lines_start, new_code_snippet)
|
||||
|
||||
if get_settings().pr_code_suggestions.include_improved_code:
|
||||
body = f"**Suggestion:** {content} [{label}]\n```suggestion\n" + new_code_snippet + "\n```"
|
||||
code_suggestions.append({'body': body, 'relevant_file': relevant_file,
|
||||
body = f"**Suggestion:** {content} [{label}]\n```suggestion\n" + new_code_snippet + "\n```"
|
||||
code_suggestions.append({'body': body, 'relevant_file': relevant_file,
|
||||
'relevant_lines_start': relevant_lines_start,
|
||||
'relevant_lines_end': relevant_lines_end})
|
||||
else:
|
||||
if self.git_provider.is_supported("create_inline_comment"):
|
||||
body = f"**Suggestion:** {content} [{label}]"
|
||||
comment = self.git_provider.create_inline_comment(body, relevant_file, "",
|
||||
absolute_position=relevant_lines_end)
|
||||
if comment:
|
||||
code_suggestions.append(comment)
|
||||
else:
|
||||
get_logger().error("Inline comments are not supported by the git provider")
|
||||
except Exception:
|
||||
if get_settings().config.verbosity_level >= 2:
|
||||
get_logger().info(f"Could not parse suggestion: {d}")
|
||||
|
||||
if get_settings().pr_code_suggestions.include_improved_code:
|
||||
is_successful = self.git_provider.publish_code_suggestions(code_suggestions)
|
||||
else:
|
||||
is_successful = self.git_provider.publish_inline_comments(code_suggestions)
|
||||
is_successful = self.git_provider.publish_code_suggestions(code_suggestions)
|
||||
if not is_successful:
|
||||
get_logger().info("Failed to publish code suggestions, trying to publish each suggestion separately")
|
||||
for code_suggestion in code_suggestions:
|
||||
if get_settings().pr_code_suggestions.include_improved_code:
|
||||
self.git_provider.publish_code_suggestions([code_suggestion])
|
||||
else:
|
||||
self.git_provider.publish_inline_comments([code_suggestion])
|
||||
self.git_provider.publish_code_suggestions([code_suggestion])
|
||||
|
||||
def dedent_code(self, relevant_file, relevant_lines_start, new_code_snippet):
|
||||
try: # dedent code snippet
|
||||
|
Reference in New Issue
Block a user