mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-03 12:20:38 +08:00
graphic adjustments
This commit is contained in:
17
Usage.md
17
Usage.md
@ -249,8 +249,12 @@ org = "https://dev.azure.com/YOUR_ORGANIZATION/"
|
||||
pat = "YOUR_PAT_TOKEN"
|
||||
```
|
||||
|
||||
#### Similar issue tool (/similar_issue)
|
||||
To enable usage of the 'similar issue' tool, you need to set the following keys in `.secrets.toml` (or in the relevant environment variables):
|
||||
#### Similar issue tool
|
||||
|
||||
Example usage:
|
||||
<img src=./pics/similar_issue_tool.png width="768">
|
||||
|
||||
To enable usage of the '**similar issue**' tool, you need to set the following keys in `.secrets.toml` (or in the relevant environment variables):
|
||||
```
|
||||
[pinecone]
|
||||
api_key = "..."
|
||||
@ -258,11 +262,10 @@ environment = "..."
|
||||
```
|
||||
These parameters can be obtained by registering to [Pinecone](https://app.pinecone.io/?sessionType=signup/).
|
||||
|
||||
To invoke the similar issue tool from **CLI**, run:
|
||||
`--issue_url=... similar_issue`
|
||||
- To invoke the 'similar issue' tool from **CLI**, run:
|
||||
`python3 cli.py --issue_url=... similar_issue`
|
||||
|
||||
To invoke the similar issue tool via online usage, [comment](https://github.com/Codium-ai/pr-agent/issues/178#issuecomment-1716934893) on a PR:
|
||||
- To invoke the 'similar' issue tool via online usage, [comment](https://github.com/Codium-ai/pr-agent/issues/178#issuecomment-1716934893) on a PR:
|
||||
`/similar_issue`
|
||||
|
||||
You can also enable the 'similar issue' tool to run automatically when a new issue is opened, by adding it to the [`pr_commands` list in the `github_app` section](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml#L66).
|
||||
```
|
||||
- You can also enable the 'similar issue' tool to run automatically when a new issue is opened, by adding it to the [pr_commands list in the github_app section](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml#L66)
|
Binary file not shown.
Before Width: | Height: | Size: 534 KiB |
BIN
pics/similar_issue_tool.png
Normal file
BIN
pics/similar_issue_tool.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 210 KiB |
@ -114,21 +114,30 @@ class PRSimilarIssue:
|
||||
filter={"repo": self.repo_name_for_index},
|
||||
include_metadata=True).to_dict()
|
||||
relevant_issues_number_list = []
|
||||
relevant_comment_number_list = []
|
||||
score_list = []
|
||||
for r in res['matches']:
|
||||
issue_number = int(r["id"].split('.')[0].split('_')[-1])
|
||||
if original_issue_number == issue_number:
|
||||
continue
|
||||
if issue_number not in relevant_issues_number_list:
|
||||
relevant_issues_number_list.append(issue_number)
|
||||
if 'comment' in r["id"]:
|
||||
relevant_comment_number_list.append(int(r["id"].split('.')[1].split('_')[-1]))
|
||||
else:
|
||||
relevant_comment_number_list.append(-1)
|
||||
score_list.append(str("{:.2f}".format(r['score'])))
|
||||
logging.info('Done')
|
||||
|
||||
logging.info('Publishing response...')
|
||||
similar_issues_str = "Similar Issues:\n\n"
|
||||
similar_issues_str = "### Similar Issues\n___\n\n"
|
||||
for i, issue_number_similar in enumerate(relevant_issues_number_list):
|
||||
issue = self.git_provider.repo_obj.get_issue(issue_number_similar)
|
||||
title = issue.title
|
||||
url = issue.html_url
|
||||
similar_issues_str += f"{i + 1}. [{title}]({url})\n\n"
|
||||
if relevant_comment_number_list[i] != -1:
|
||||
url = list(issue.get_comments())[relevant_comment_number_list[i]].html_url
|
||||
similar_issues_str += f"{i + 1}. **[{title}]({url})** (score={score_list[i]})\n\n"
|
||||
if get_settings().config.publish_output:
|
||||
response = issue_main.create_comment(similar_issues_str)
|
||||
logging.info(similar_issues_str)
|
||||
|
Reference in New Issue
Block a user