|
1 | 1 | ## Overview
|
2 | 2 |
|
3 |
| -The `help_docs` tool answers a question based on a given relative path of documentation (which defaults to docs/), either from the repository of this merge request or from a given one. |
| 3 | +The `help_docs` tool can answer a free-text question based on a git documentation folder. |
| 4 | + |
4 | 5 | It can be invoked manually by commenting on any PR or Issue:
|
5 | 6 | ```
|
6 | 7 | /help_docs "..."
|
| 8 | +``` |
| 9 | +Or configured to be triggered automatically when a [new issue is opened](#run-as-a-github-action). |
| 10 | + |
| 11 | +The tool assumes by default that the documentation is located in the root of the repository, at `/docs` folder. |
| 12 | +However, this can be customized by setting the `docs_path` configuration option: |
| 13 | + |
| 14 | +```toml |
| 15 | +[pr_help_docs] |
| 16 | +repo_url = "" # The repository to use as context |
| 17 | +docs_path = "docs" # The documentation folder |
| 18 | +repo_default_branch = "main" # The branch to use in case repo_url overwritten |
| 19 | + |
7 | 20 | ```
|
8 | 21 |
|
| 22 | +See more configuration options in the [Configuration options](#configuration-options) section. |
| 23 | + |
9 | 24 | ## Example usage
|
10 |
| -#### Asking a question about this repository: |
11 |
| -{width=512} |
12 | 25 |
|
13 |
| -#### Asking a question about another repository under branch: main: |
14 |
| -{width=512} |
| 26 | +[//]: # (#### Asking a question about this repository:) |
15 | 27 |
|
16 |
| -#### Response for the first question: |
17 |
| -{width=512} |
| 28 | +[//]: # ({width=512}) |
18 | 29 |
|
19 |
| -## Configuration options |
| 30 | +**Asking a question about another repository** |
20 | 31 |
|
21 |
| -Under the section `pr_help_docs`, the [configuration file](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml#L50) contains options to customize the 'help docs' tool: |
| 32 | +{width=512} |
22 | 33 |
|
23 |
| -- `repo_url`: If not overwritten, will use the repo from where the context came from (issue or PR), otherwise - use the given repo as context. |
24 |
| -- `repo_default_branch`: The branch to use in case repo_url overwritten, otherwise - has no effect. |
25 |
| -- `docs_path`: Relative path from root of repository (either the one this PR has been issued for, or above repo url). |
26 |
| -- `exclude_root_readme`: Whether or not to exclude the root README file for querying the model. |
27 |
| -- `supported_doc_exts` : Which file extensions should be included for the purpose of querying the model. |
| 34 | +**Response**: |
28 | 35 |
|
29 |
| ---- |
30 |
| -## Run as a GitHub Action |
| 36 | +{width=512} |
| 37 | + |
| 38 | +## Run automatically when a new issue is opened |
31 | 39 |
|
32 |
| -You can use our pre-built Github Action Docker image to run help_docs on any newly created issue, as a Github Action. Here's how: |
| 40 | +You can configure PR-Agent to run `help_docs` automatically on any newly created issue. |
| 41 | +This can be useful, for example, for providing immediate feedback to users who open issues with questions on open-source projects with extensive documentation. |
| 42 | + |
| 43 | +Here's how: |
33 | 44 |
|
34 | 45 | 1) Follow the steps depicted under [Run as a Github Action](https://qodo-merge-docs.qodo.ai/installation/github/#run-as-a-github-action) to create a new workflow, such as:`.github/workflows/help_docs.yml`:
|
35 | 46 |
|
@@ -76,10 +87,22 @@ jobs:
|
76 | 87 | export github__user_token=$GITHUB_TOKEN && \
|
77 | 88 | export github__base_url=$GITHUB_API_URL && \
|
78 | 89 | export openai__key=$OPENAI_KEY && \
|
79 |
| - export config__verbosity_level=2 && \ |
80 |
| - python -m pr_agent.cli --issue_url=$ISSUE_URL help_docs \"$ISSUE_BODY\"" |
| 90 | + python -m pr_agent.cli --issue_url=$ISSUE_URL --pr_help_docs.repo_url="..." --pr_help_docs.docs_path="..." --pr_help_docs.openai_key=$OPENAI_KEY && \help_docs \"$ISSUE_BODY\"" |
81 | 91 | ```
|
82 | 92 |
|
83 |
| -3) Following completion of the remaining steps (such as adding secrets and any env. variables), merge this change to your main branch. |
84 |
| -When a new issue is opened, you should see a comment from `github-actions` bot with an auto response, assuming the question is a relevant one. |
| 93 | +3) Following completion of the remaining steps (such as adding secrets and relevant configurations, such as `repo_url` and `docs_path`) merge this change to your main branch. |
| 94 | +When a new issue is opened, you should see a comment from `github-actions` bot with an auto response, assuming the question is related to the documentation of the repository. |
| 95 | +--- |
| 96 | + |
| 97 | + |
| 98 | +## Configuration options |
| 99 | + |
| 100 | +Under the section `pr_help_docs`, the [configuration file](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml#L50) contains options to customize the 'help docs' tool: |
| 101 | + |
| 102 | +- `repo_url`: If not overwritten, will use the repo from where the context came from (issue or PR), otherwise - use the given repo as context. |
| 103 | +- `repo_default_branch`: The branch to use in case repo_url overwritten, otherwise - has no effect. |
| 104 | +- `docs_path`: Relative path from root of repository (either the one this PR has been issued for, or above repo url). |
| 105 | +- `exclude_root_readme`: Whether or not to exclude the root README file for querying the model. |
| 106 | +- `supported_doc_exts` : Which file extensions should be included for the purpose of querying the model. |
| 107 | + |
85 | 108 | ---
|
0 commit comments