rename vars + Add to README.md

This commit is contained in:
Hussam.lawen
2023-10-01 13:52:00 +03:00
parent ccc7f1e10a
commit ab5ac8ffa8
4 changed files with 11 additions and 9 deletions

View File

@ -28,7 +28,8 @@ CodiumAI `PR-Agent` is an open-source tool aiming to help developers review pull
**Update Changelog (`/update_changelog`)**: Automatically updating the CHANGELOG.md file with the [PR changes](https://github.com/Codium-ai/pr-agent/pull/168#discussion_r1282077645).
\
**Find similar issue (`/similar_issue`)**: Automatically retrieves and presents [similar issues](https://github.com/Alibaba-MIIL/ASL/issues/107).
\
**Add Documentation (`/add_docs`)**: Automatically adds [documentation](https://github.com/Codium-ai/pr-agent/pull/337#discussion_r1342111682) to un-documented functions/classes in the PR.
See the [usage guide](./Usage.md) for instructions how to run the different tools from [CLI](./Usage.md#working-from-a-local-repo-cli), or by [online usage](./Usage.md#online-usage), as well as additional details on optional commands and configurations.
@ -109,6 +110,7 @@ See the [usage guide](./Usage.md) for instructions how to run the different tool
| | Reflect and Review | :white_check_mark: | :white_check_mark: | :white_check_mark: | | :white_check_mark: | :white_check_mark: |
| | Update CHANGELOG.md | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | |
| | Find similar issue | :white_check_mark: | | | | | |
| | Add Documentation | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | :white_check_mark: |
| | | | | | | |
| USAGE | CLI | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| | App / webhook | :white_check_mark: | :white_check_mark: | | | |

View File

@ -47,7 +47,7 @@ rank_extended_suggestions = true
max_number_of_calls = 5
final_clip_factor = 0.9
[pr_add_docs_prompt] # /add_docs #
[pr_add_docs] # /add_docs #
extra_instructions = ""
docs_style = "Google Style" # "Google Style", "Numpy Style", "Sphinx Style", "PEP257", "reStructuredText"
max_number_of_calls = 5

View File

@ -93,9 +93,9 @@ Don't repeat the prompt in the answer, and avoid outputting the 'type' and 'desc
user="""PR Info:
Title: '{{title}}'
Title: '{{ title }}'
Branch: '{{branch}}'
Branch: '{{ branch }}'
Description: '{{description}}'

View File

@ -37,10 +37,10 @@ class PRAddDocs:
"description": self.git_provider.get_pr_description(),
"language": self.main_language,
"diff": "", # empty diff for initial calculation
"extra_instructions": get_settings().pr_add_docs_prompt.extra_instructions,
"extra_instructions": get_settings().pr_add_docs.extra_instructions,
"commit_messages_str": self.git_provider.get_commit_messages(),
'docs_for_language': get_docs_for_language(self.main_language,
get_settings().pr_add_docs_prompt.docs_style),
get_settings().pr_add_docs.docs_style),
}
self.token_handler = TokenHandler(self.git_provider.pr,
self.vars,
@ -132,8 +132,8 @@ class PRAddDocs:
is_successful = self.git_provider.publish_code_suggestions(docs)
if not is_successful:
logging.info("Failed to publish code docs, trying to publish each docs separately")
for documentation in docs:
self.git_provider.publish_code_suggestions([documentation])
for doc_suggestion in docs:
self.git_provider.publish_code_suggestions([doc_suggestion])
def dedent_code(self, relevant_file, relevant_lines_start, new_code_snippet, doc_placement='after',
add_original_line=False):
@ -170,7 +170,7 @@ class PRAddDocs:
async def _prepare_prediction_extended(self, model: str) -> dict:
logging.info('Getting PR diff...')
patches_diff_list = get_pr_multi_diffs(self.git_provider, self.token_handler, model,
max_calls=get_settings().pr_add_docs_prompt.max_number_of_calls)
max_calls=get_settings().pr_add_docs.max_number_of_calls)
logging.info('Getting multi AI predictions...')
prediction_list = []