pr-agent/docs/docs/tools/ask.md

59 lines
2.1 KiB
Markdown
Raw Normal View History

2024-03-06 19:52:11 +00:00
## Overview
2023-09-29 06:47:13 +00:00
2024-01-09 14:34:27 +00:00
The `ask` tool answers questions about the PR, based on the PR code changes. Make sure to be specific and clear in your questions.
2023-09-29 06:47:13 +00:00
It can be invoked manually by commenting on any PR:
```
/ask "..."
```
2024-04-18 06:10:14 +00:00
## Example usage
2024-03-06 19:52:11 +00:00
2024-04-14 09:34:14 +00:00
![Ask Comment](https://codium.ai/images/pr_agent/ask_comment.png){width=512}
2024-03-06 19:52:11 +00:00
2024-04-14 09:34:14 +00:00
![Ask](https://codium.ai/images/pr_agent/ask.png){width=512}
2024-01-09 14:25:23 +00:00
2024-02-15 13:20:15 +00:00
## Ask lines
2024-03-06 19:52:11 +00:00
2024-02-15 13:20:15 +00:00
You can run `/ask` on specific lines of code in the PR from the PR's diff view. The tool will answer questions based on the code changes in the selected lines.
2024-02-18 06:07:12 +00:00
- Click on the '+' sign next to the line number to select the line.
- To select multiple lines, click on the '+' sign of the first line and then hold and drag to select the rest of the lines.
2024-02-15 13:20:15 +00:00
- write `/ask "..."` in the comment box and press `Add single comment` button.
2024-04-14 09:34:14 +00:00
![Ask Line](https://codium.ai/images/pr_agent/Ask_line.png){width=512}
2024-02-15 13:20:15 +00:00
2024-03-06 19:52:11 +00:00
Note that the tool does not have "memory" of previous questions, and answers each question independently.
2024-04-14 09:34:14 +00:00
2024-04-14 11:45:15 +00:00
## Ask on images
2024-04-14 09:34:14 +00:00
2024-04-15 07:12:19 +00:00
You can also ask questions about images that appear in the comment, where the entire PR code will be used as context.
<br>
2024-04-14 09:34:14 +00:00
The basic syntax is:
```
/ask "..."
[Image](https://real_link_to_image)
```
2024-04-15 07:12:19 +00:00
where `https://real_link_to_image` is the direct link to the image.
2024-04-14 09:34:14 +00:00
2024-04-15 07:12:19 +00:00
Note that GitHub has a built-in mechanism of pasting images in comments. However, pasted image does not provide a direct link.
To get a direct link to an image, we recommend using the following scheme:
2024-04-14 11:45:15 +00:00
2024-04-15 07:12:19 +00:00
1) First, post a comment that contains **only** the image:
2024-04-14 09:34:14 +00:00
![Ask image1](https://codium.ai/images/pr_agent/ask_images1.png){width=512}
2024-04-15 07:12:19 +00:00
2) Quote reply to that comment:
2024-04-14 09:34:14 +00:00
![Ask image2](https://codium.ai/images/pr_agent/ask_images2.png){width=512}
2024-04-15 07:12:19 +00:00
3) In the screen opened, type the question below the image:
2024-04-14 09:34:14 +00:00
![Ask image3](https://codium.ai/images/pr_agent/ask_images3.png){width=512}
2024-04-14 11:45:15 +00:00
![Ask image4](https://codium.ai/images/pr_agent/ask_images4.png){width=512}
2024-04-14 09:34:14 +00:00
2024-04-15 07:12:19 +00:00
4) Post the comment, and receive the answer:
2024-04-14 09:34:14 +00:00
2024-04-14 11:45:15 +00:00
![Ask image5](https://codium.ai/images/pr_agent/ask_images5.png){width=512}
See a full video tutorial [here](https://codium.ai/images/pr_agent/ask_image_video.mov)