mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-03 20:30:41 +08:00
Compare commits
1 Commits
add-pr-tem
...
mrT23-patc
Author | SHA1 | Date | |
---|---|---|---|
0cabf57247 |
38
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
38
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@ -1,38 +0,0 @@
|
||||
name: "\U0001FAB2 Bug Report"
|
||||
description: Submit a bug report
|
||||
labels: ["bug"]
|
||||
body:
|
||||
|
||||
- type: dropdown
|
||||
id: information-git-provider
|
||||
attributes:
|
||||
label: Git provider
|
||||
description: 'The problem arises when using:'
|
||||
options:
|
||||
- "Github Cloud"
|
||||
- "Github Enterprise"
|
||||
- "Gitlab"
|
||||
- "Bitbucket Cloud"
|
||||
- "Bitbucket Server"
|
||||
- "Azure"
|
||||
- "Other"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: system-info
|
||||
attributes:
|
||||
label: System Info
|
||||
description: Please share your system info with us.
|
||||
placeholder: model used, deployment type (action/app/cli/...), etc...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: bug-details
|
||||
attributes:
|
||||
label: Bug details
|
||||
description: Please describe the problem.
|
||||
placeholder: Describe the problem
|
||||
validations:
|
||||
required: true
|
10
.github/ISSUE_TEMPLATE/config.yml
vendored
10
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,10 +0,0 @@
|
||||
blank_issues_enabled: false
|
||||
version: 0.1
|
||||
contact_links:
|
||||
- name: Discussions
|
||||
url: https://github.com/qodo-ai/pr-agent/discussions
|
||||
about: GitHub Discussions
|
||||
|
||||
- name: Discord community
|
||||
url: https://discord.com/channels/1057273017547378788/1126104260430528613
|
||||
about: Join our discord community
|
21
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
21
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
@ -1,21 +0,0 @@
|
||||
name: "\U0001F4A1 Feature request"
|
||||
description: Submit a proposal/request for a new PR-Agent feature
|
||||
labels: ["feature"]
|
||||
body:
|
||||
- type: textarea
|
||||
id: feature-request
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: Feature request
|
||||
description: |
|
||||
Description of the feature proposal.
|
||||
|
||||
- type: textarea
|
||||
id: motivation
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: Motivation
|
||||
description: |
|
||||
Outline the motivation for the proposal.
|
36
.github/ISSUE_TEMPLATE/miscellaneous.yml
vendored
36
.github/ISSUE_TEMPLATE/miscellaneous.yml
vendored
@ -1,36 +0,0 @@
|
||||
name: "❔ General Issue"
|
||||
description: Submit a general issue
|
||||
labels: ["general"]
|
||||
body:
|
||||
|
||||
- type: dropdown
|
||||
id: information-git-provider
|
||||
attributes:
|
||||
label: Git provider (optional)
|
||||
description: 'Git Provider:'
|
||||
options:
|
||||
- "Github Cloud"
|
||||
- "Github Enterprise"
|
||||
- "Gitlab"
|
||||
- "Bitbucket Cloud"
|
||||
- "Bitbucket Server"
|
||||
- "Azure"
|
||||
- "Other"
|
||||
|
||||
- type: textarea
|
||||
id: system-info
|
||||
attributes:
|
||||
label: System Info (optional)
|
||||
description: Please share your system info with us.
|
||||
placeholder: model used, deployment type (action/app/cli/...), etc...
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: issues-details
|
||||
attributes:
|
||||
label: Issues details
|
||||
description: Please share the issues details.
|
||||
placeholder: Describe the issue
|
||||
validations:
|
||||
required: true
|
@ -1,45 +0,0 @@
|
||||
# Contributor Code of Conduct
|
||||
|
||||
As contributors and maintainers of this project, and in the interest of fostering an open
|
||||
and welcoming community, we pledge to respect all people who contribute through reporting
|
||||
issues, posting feature requests, updating documentation, submitting pull requests or
|
||||
patches, and other activities.
|
||||
|
||||
We are committed to making participation in this project a harassment-free experience for
|
||||
everyone, regardless of level of experience, gender, gender identity and expression,
|
||||
sexual orientation, disability, personal appearance, body size, race, ethnicity, age,
|
||||
religion, or nationality.
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery
|
||||
* Personal attacks
|
||||
* Trolling or insulting/derogatory comments
|
||||
* Public or private harassment
|
||||
* Publishing other's private information, such as physical or electronic addresses,
|
||||
without explicit permission
|
||||
* Other unethical or unprofessional conduct
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments,
|
||||
commits, code, wiki edits, issues, and other contributions that are not aligned to this
|
||||
Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors
|
||||
that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
By adopting this Code of Conduct, project maintainers commit themselves to fairly and
|
||||
consistently applying these principles to every aspect of managing this project. Project
|
||||
maintainers who do not follow or enforce the Code of Conduct may be permanently removed
|
||||
from the project team.
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an
|
||||
individual is representing the project or its community.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
|
||||
contacting a project maintainer at tal.r@qodo.ai . All complaints will
|
||||
be reviewed and investigated and will result in a response that is deemed necessary and
|
||||
appropriate to the circumstances. Maintainers are obligated to maintain confidentiality
|
||||
with regard to the reporter of an incident.
|
||||
|
||||
This Code of Conduct is adapted from the
|
||||
[Contributor Covenant](https://contributor-covenant.org), version 1.3.0, available at
|
||||
[contributor-covenant.org/version/1/3/0/](https://contributor-covenant.org/version/1/3/0/)
|
||||
|
@ -1,38 +0,0 @@
|
||||
# Contributing to PR-Agent
|
||||
|
||||
Thank you for your interest in contributing to the PR-Agent project!
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. Fork the repository and clone your fork
|
||||
2. Install Python 3.10 or higher
|
||||
3. Install dependencies (`requirements.txt` and `requirements-dev.txt`)
|
||||
4. Create a new branch for your contribution:
|
||||
- For new features: `git checkout -b feature/your-feature-name`
|
||||
- For bug fixes: `git checkout -b fix/issue-description`
|
||||
5. Make your changes
|
||||
6. Write or update tests as needed
|
||||
7. Run tests locally to ensure everything passes
|
||||
8. Commit your changes using conventional commit messages
|
||||
9. Push to your fork and submit a pull request
|
||||
|
||||
## Development Guidelines
|
||||
|
||||
- Keep pull requests focused on a single feature or fix
|
||||
- Follow the existing code style and formatting conventions
|
||||
- Add unit tests for any new functionality using pytest
|
||||
- Ensure test coverage for your changes
|
||||
- Update documentation as needed
|
||||
|
||||
## Pull Request Process
|
||||
|
||||
1. Ensure your PR includes a clear description of the changes
|
||||
2. Link any related issues
|
||||
3. Update the README.md if needed
|
||||
4. Wait for review from maintainers
|
||||
|
||||
## Questions or Need Help?
|
||||
|
||||
- Join our [Discord community](https://discord.com/channels/1057273017547378788/1126104260430528613) for questions and discussions
|
||||
- Check the [documentation](https://qodo-merge-docs.qodo.ai/) for detailed information
|
||||
- Report bugs or request features through [GitHub Issues](https://github.com/qodo-ai/pr-agent/issues)
|
@ -1,48 +0,0 @@
|
||||
## 📌 Pull Request Template
|
||||
|
||||
### 1️⃣ Short Description
|
||||
<!-- Provide a concise summary of the changes in this PR. -->
|
||||
|
||||
---
|
||||
|
||||
### 2️⃣ Related Open Issue
|
||||
<!-- Link the related issue(s) this PR is addressing, e.g., Fixes #123 or Closes #456. -->
|
||||
Fixes #
|
||||
|
||||
---
|
||||
|
||||
### 3️⃣ PR Type
|
||||
<!-- Select one of the following by marking `[x]` -->
|
||||
|
||||
- [ ] 🐞 Bug Fix
|
||||
- [ ] ✨ New Feature
|
||||
- [ ] 🔄 Refactoring
|
||||
- [ ] 📖 Documentation Update
|
||||
|
||||
---
|
||||
|
||||
### 4️⃣ Does this PR Introduce a Breaking Change?
|
||||
<!-- Mark the applicable option -->
|
||||
- [ ] ❌ No
|
||||
- [ ] ⚠️ Yes (Explain below)
|
||||
|
||||
If **yes**, describe the impact and necessary migration steps:
|
||||
<!-- Provide a short explanation of what needs to be changed. -->
|
||||
|
||||
---
|
||||
|
||||
### 5️⃣ Current Behavior (Before Changes)
|
||||
<!-- Describe the existing behavior before applying the changes in this PR. -->
|
||||
|
||||
---
|
||||
|
||||
### 6️⃣ New Behavior (After Changes)
|
||||
<!-- Explain how the behavior changes with this PR. -->
|
||||
|
||||
---
|
||||
|
||||
### ✅ Checklist
|
||||
- [ ] Code follows the project's coding guidelines.
|
||||
- [ ] Tests have been added or updated (if applicable).
|
||||
- [ ] Documentation has been updated (if applicable).
|
||||
- [ ] Ready for review and approval.
|
@ -69,7 +69,7 @@ Update logic and [documentation](https://qodo-merge-docs.qodo.ai/usage-guide/cha
|
||||
|
||||
### December 30, 2024
|
||||
|
||||
Following feedback from the community, we have addressed two vulnerabilities identified in the open-source PR-Agent project. The fixes are now included in the newly released version (v0.26), available as of today.
|
||||
Following [feedback](https://research.kudelskisecurity.com/2024/08/29/careful-where-you-code-multiple-vulnerabilities-in-ai-powered-pr-agent/) from the community, we have addressed two vulnerabilities identified in the open-source PR-Agent project. The fixes are now included in the newly released version (v0.26), available as of today.
|
||||
|
||||
### December 25, 2024
|
||||
|
||||
|
62
SECURITY.md
62
SECURITY.md
@ -1,62 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
PR-Agent is an open-source tool to help efficiently review and handle pull requests. Qodo Merge is a paid version of PR-Agent, designed for companies and teams that require additional features and capabilities.
|
||||
|
||||
This document describes the security policy of PR-Agent. For Qodo Merge's security policy, see [here](https://qodo-merge-docs.qodo.ai/overview/data_privacy/#qodo-merge).
|
||||
|
||||
## PR-Agent Self-Hosted Solutions
|
||||
|
||||
When using PR-Agent with your OpenAI (or other LLM provider) API key, the security relationship is directly between you and the provider. We do not send your code to Qodo servers.
|
||||
|
||||
Types of [self-hosted solutions](https://qodo-merge-docs.qodo.ai/installation):
|
||||
- Locally
|
||||
- GitHub integration
|
||||
- GitLab integration
|
||||
- BitBucket integration
|
||||
- Azure DevOps integration
|
||||
|
||||
|
||||
## PR-Agent Supported Versions
|
||||
|
||||
This section outlines which versions of PR-Agent are currently supported with security updates.
|
||||
|
||||
### Docker Deployment Options
|
||||
|
||||
#### Latest Version
|
||||
|
||||
For the most recent updates, use our latest Docker image which is automatically built nightly:
|
||||
```yaml
|
||||
uses: qodo-ai/pr-agent@main
|
||||
```
|
||||
|
||||
#### Specific Release Version
|
||||
|
||||
For a fixed version, you can pin your action to a specific release version. Browse available releases at:
|
||||
[PR-Agent Releases](https://github.com/qodo-ai/pr-agent/releases)
|
||||
|
||||
For example, to github action:
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- name: PR Agent action step
|
||||
id: pragent
|
||||
uses: docker://codiumai/pr-agent:0.26-github_action
|
||||
```
|
||||
|
||||
#### Enhanced Security with Docker Digest
|
||||
|
||||
For maximum security, you can specify the Docker image using its digest:
|
||||
```yaml
|
||||
steps:
|
||||
- name: PR Agent action step
|
||||
id: pragent
|
||||
uses: docker://codiumai/pr-agent@sha256:14165e525678ace7d9b51cda8652c2d74abb4e1d76b57c4a6ccaeba84663cc64
|
||||
```
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
We take the security of PR-Agent seriously. If you discover a security vulnerability, please report it immediately to:
|
||||
|
||||
Email: tal.r@qodo.ai
|
||||
|
||||
Please include a description of the vulnerability, steps to reproduce, and the affected PR-Agent version.
|
@ -4,7 +4,7 @@ WORKDIR /app
|
||||
ADD pyproject.toml .
|
||||
ADD requirements.txt .
|
||||
ADD docs docs
|
||||
RUN pip install --no-cache-dir . && rm pyproject.toml requirements.txt
|
||||
RUN pip install . && rm pyproject.toml requirements.txt
|
||||
ENV PYTHONPATH=/app
|
||||
|
||||
FROM base AS github_app
|
||||
@ -33,7 +33,7 @@ CMD ["python", "pr_agent/servers/azuredevops_server_webhook.py"]
|
||||
|
||||
FROM base AS test
|
||||
ADD requirements-dev.txt .
|
||||
RUN pip install --no-cache-dir -r requirements-dev.txt && rm requirements-dev.txt
|
||||
RUN pip install -r requirements-dev.txt && rm requirements-dev.txt
|
||||
ADD pr_agent pr_agent
|
||||
ADD tests tests
|
||||
|
||||
|
@ -5,8 +5,8 @@ RUN yum update -y && \
|
||||
yum clean all
|
||||
|
||||
ADD pyproject.toml requirements.txt .
|
||||
RUN pip install --no-cache-dir . && rm pyproject.toml
|
||||
RUN pip install --no-cache-dir mangum==0.17.0
|
||||
RUN pip install . && rm pyproject.toml
|
||||
RUN pip install mangum==0.17.0
|
||||
COPY pr_agent/ ${LAMBDA_TASK_ROOT}/pr_agent/
|
||||
|
||||
CMD ["pr_agent.servers.serverless.serverless"]
|
||||
|
@ -19,7 +19,6 @@ Here are some additional technical blogs from Qodo, that delve deeper into the c
|
||||
These resources provide more comprehensive insights into leveraging LLMs for software development.
|
||||
|
||||
### Code Generation and LLMs
|
||||
- [Effective AI code suggestions: less is more](https://www.qodo.ai/blog/effective-code-suggestions-llms-less-is-more/)
|
||||
- [State-of-the-art Code Generation with AlphaCodium – From Prompt Engineering to Flow Engineering](https://www.qodo.ai/blog/qodoflow-state-of-the-art-code-generation-for-code-contests/)
|
||||
- [RAG for a Codebase with 10k Repos](https://www.qodo.ai/blog/rag-for-large-scale-code-repos/)
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
`Platforms supported: GitHub, GitLab, Bitbucket`
|
||||
|
||||
## Overview
|
||||
|
||||
The `implement` tool converts human code review discussions and feedback into ready-to-commit code changes.
|
||||
|
@ -2,37 +2,17 @@
|
||||
|
||||
The default models used by Qodo Merge are a combination of Claude-3.5-sonnet and OpenAI's GPT-4 models.
|
||||
|
||||
### Selecting a Specific Model
|
||||
Users can configure Qodo Merge to use solely a specific model by editing the [configuration](https://qodo-merge-docs.qodo.ai/usage-guide/configuration_options/) file.
|
||||
|
||||
Users can configure Qodo Merge to use a specific model by editing the [configuration](https://qodo-merge-docs.qodo.ai/usage-guide/configuration_options/) file.
|
||||
The models supported by Qodo Merge are:
|
||||
|
||||
- `claude-3-5-sonnet`
|
||||
- `gpt-4o`
|
||||
- `deepseek-r1`
|
||||
- `o3-mini`
|
||||
|
||||
To restrict Qodo Merge to using only `Claude-3.5-sonnet`, add this setting:
|
||||
For example, to restrict Qodo Merge to using only `Claude-3.5-sonnet`, add this setting:
|
||||
|
||||
```
|
||||
[config]
|
||||
model="claude-3-5-sonnet"
|
||||
```
|
||||
|
||||
To restrict Qodo Merge to using only `GPT-4o`, add this setting:
|
||||
Or to restrict Qodo Merge to using only `GPT-4o`, add this setting:
|
||||
```
|
||||
[config]
|
||||
model="gpt-4o"
|
||||
```
|
||||
|
||||
To restrict Qodo Merge to using only `deepseek-r1`, add this setting:
|
||||
```
|
||||
[config]
|
||||
model="deepseek/r1"
|
||||
```
|
||||
|
||||
To restrict Qodo Merge to using only `o3-mini`, add this setting:
|
||||
```
|
||||
[config]
|
||||
model="o3-mini"
|
||||
```
|
||||
|
@ -26,8 +26,6 @@ MAX_TOKENS = {
|
||||
'o1-preview-2024-09-12': 128000, # 128K, but may be limited by config.max_model_tokens
|
||||
'o1-2024-12-17': 204800, # 200K, but may be limited by config.max_model_tokens
|
||||
'o1': 204800, # 200K, but may be limited by config.max_model_tokens
|
||||
'o3-mini': 204800, # 200K, but may be limited by config.max_model_tokens
|
||||
'o3-mini-2025-01-31': 204800, # 200K, but may be limited by config.max_model_tokens
|
||||
'claude-instant-1': 100000,
|
||||
'claude-2': 100000,
|
||||
'command-nightly': 4096,
|
||||
@ -83,13 +81,3 @@ MAX_TOKENS = {
|
||||
"watsonx/ibm/granite-34b-code-instruct": 8191,
|
||||
"watsonx/mistralai/mistral-large": 32768,
|
||||
}
|
||||
|
||||
USER_MESSAGE_ONLY_MODELS = [
|
||||
"deepseek/deepseek-reasoner",
|
||||
"o1-mini",
|
||||
"o1-mini-2024-09-12",
|
||||
"o1",
|
||||
"o1-2024-12-17",
|
||||
"o3-mini",
|
||||
"o3-mini-2025-01-31"
|
||||
]
|
||||
|
@ -6,7 +6,6 @@ import requests
|
||||
from litellm import acompletion
|
||||
from tenacity import retry, retry_if_exception_type, stop_after_attempt
|
||||
|
||||
from pr_agent.algo import USER_MESSAGE_ONLY_MODELS
|
||||
from pr_agent.algo.ai_handlers.base_ai_handler import BaseAiHandler
|
||||
from pr_agent.algo.utils import get_version
|
||||
from pr_agent.config_loader import get_settings
|
||||
@ -95,9 +94,6 @@ class LiteLLMAIHandler(BaseAiHandler):
|
||||
if get_settings().get("DEEPSEEK.KEY", None):
|
||||
os.environ['DEEPSEEK_API_KEY'] = get_settings().get("DEEPSEEK.KEY")
|
||||
|
||||
# Models that only use user meessage
|
||||
self.user_message_only_models = USER_MESSAGE_ONLY_MODELS
|
||||
|
||||
def prepare_logs(self, response, system, user, resp, finish_reason):
|
||||
response_log = response.dict().copy()
|
||||
response_log['system'] = system
|
||||
@ -201,8 +197,10 @@ class LiteLLMAIHandler(BaseAiHandler):
|
||||
messages[1]["content"] = [{"type": "text", "text": messages[1]["content"]},
|
||||
{"type": "image_url", "image_url": {"url": img_path}}]
|
||||
|
||||
# Currently, some models do not support a separate system and user prompts
|
||||
if self.user_message_only_models and any(entry.lower() in model.lower() for entry in self.user_message_only_models):
|
||||
# Currently, model OpenAI o1 series does not support a separate system and user prompts
|
||||
O1_MODEL_PREFIX = 'o1'
|
||||
model_type = model.split('/')[-1] if '/' in model else model
|
||||
if (model_type.startswith(O1_MODEL_PREFIX)) or ("deepseek-reasoner" in model):
|
||||
user = f"{system}\n\n\n{user}"
|
||||
system = ""
|
||||
get_logger().info(f"Using model {model}, combining system and user prompts")
|
||||
|
@ -735,7 +735,7 @@ def try_fix_yaml(response_text: str,
|
||||
get_logger().info(f"Successfully parsed AI prediction after adding |-\n")
|
||||
return data
|
||||
except:
|
||||
pass
|
||||
get_logger().info(f"Failed to parse AI prediction after adding |-\n")
|
||||
|
||||
# second fallback - try to extract only range from first ```yaml to ````
|
||||
snippet_pattern = r'```(yaml)?[\s\S]*?```'
|
||||
@ -779,18 +779,9 @@ def try_fix_yaml(response_text: str,
|
||||
except:
|
||||
pass
|
||||
|
||||
# fifth fallback - try to remove leading '+' (sometimes added by AI for 'existing code' and 'improved code')
|
||||
response_text_lines_copy = response_text_lines.copy()
|
||||
for i in range(0, len(response_text_lines_copy)):
|
||||
response_text_lines_copy[i] = ' ' + response_text_lines_copy[i][1:]
|
||||
try:
|
||||
data = yaml.safe_load('\n'.join(response_text_lines_copy))
|
||||
get_logger().info(f"Successfully parsed AI prediction after removing leading '+'")
|
||||
return data
|
||||
except:
|
||||
pass
|
||||
|
||||
# sixth fallback - try to remove last lines
|
||||
# fifth fallback - try to remove last lines
|
||||
data = {}
|
||||
for i in range(1, len(response_text_lines)):
|
||||
response_text_lines_tmp = '\n'.join(response_text_lines[:-i])
|
||||
try:
|
||||
|
@ -9,7 +9,7 @@ from datetime import datetime
|
||||
from typing import Optional, Tuple
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from github import AppAuthentication, Auth, Github, GithubException
|
||||
from github import AppAuthentication, Auth, Github
|
||||
from retry import retry
|
||||
from starlette_context import context
|
||||
|
||||
@ -475,17 +475,8 @@ class GithubProvider(GitProvider):
|
||||
return False
|
||||
|
||||
def edit_comment(self, comment, body: str):
|
||||
try:
|
||||
body = self.limit_output_characters(body, self.max_comment_chars)
|
||||
comment.edit(body=body)
|
||||
except GithubException as e:
|
||||
if hasattr(e, "status") and e.status == 403:
|
||||
# Log as warning for permission-related issues (usually due to polling)
|
||||
get_logger().warning(
|
||||
"Failed to edit github comment due to permission restrictions",
|
||||
artifact={"error": e})
|
||||
else:
|
||||
get_logger().exception(f"Failed to edit github comment", artifact={"error": e})
|
||||
body = self.limit_output_characters(body, self.max_comment_chars)
|
||||
comment.edit(body=body)
|
||||
|
||||
def edit_comment_from_comment_id(self, comment_id: int, body: str):
|
||||
try:
|
||||
|
@ -130,14 +130,12 @@ async def is_valid_notification(notification, headers, handled_ids, session, use
|
||||
artifact={"comment": comment_body})
|
||||
return True, handled_ids, comment, comment_body, pr_url, user_tag
|
||||
|
||||
get_logger().warning(f"Failed to fetch comments for PR: {pr_url}",
|
||||
artifact={"comments": comments})
|
||||
get_logger().error(f"Failed to fetch comments for PR: {pr_url}")
|
||||
return False, handled_ids
|
||||
|
||||
return False, handled_ids
|
||||
except Exception as e:
|
||||
get_logger().exception(f"Error processing polling notification",
|
||||
artifact={"notification": notification, "error": e})
|
||||
get_logger().error(f"Error processing notification: {e}", artifact={"traceback": traceback.format_exc()})
|
||||
return False, handled_ids
|
||||
|
||||
|
||||
|
@ -121,9 +121,6 @@ max_history_len=4
|
||||
apply_suggestions_checkbox=true
|
||||
# suggestions scoring
|
||||
suggestions_score_threshold=0 # [0-10]| recommend not to set this value above 8, since above it may clip highly relevant suggestions
|
||||
new_score_mechanism=true
|
||||
new_score_mechanism_th_high=9
|
||||
new_score_mechanism_th_medium=7
|
||||
# params for '/improve --extended' mode
|
||||
auto_extended_mode=true
|
||||
num_code_suggestions_per_chunk=4
|
||||
|
@ -90,7 +90,7 @@ class CodeSuggestion(BaseModel):
|
||||
{%- if not focus_only_on_problems %}
|
||||
label: str = Field(description="A single, descriptive label that best characterizes the suggestion type. Possible labels include 'security', 'possible bug', 'possible issue', 'performance', 'enhancement', 'best practice', 'maintainability', 'typo'. Other relevant labels are also acceptable.")
|
||||
{%- else %}
|
||||
label: str = Field(description="A single, descriptive label that best characterizes the suggestion type. Possible labels include 'security', 'critical bug', 'general'. The 'general' section should be used for suggestions that address a major issue, but are not necessarily on a critical level.")
|
||||
label: str = Field(description="A single, descriptive label that best characterizes the suggestion type. Possible labels include 'security', 'critical bug', 'general'. The 'general' section should be used for suggestions that address a major issue, but are necessarily on a critical level.")
|
||||
{%- endif %}
|
||||
|
||||
|
||||
|
@ -720,7 +720,7 @@ class PRCodeSuggestions:
|
||||
header = f"Suggestion"
|
||||
delta = 66
|
||||
header += " " * delta
|
||||
pr_body += f"""<thead><tr><td><strong>Category</strong></td><td align=left><strong>{header}</strong></td><td align=center><strong>Impact</strong></td></tr>"""
|
||||
pr_body += f"""<thead><tr><td>Category</td><td align=left>{header}</td><td align=center>Score</td></tr>"""
|
||||
pr_body += """<tbody>"""
|
||||
suggestions_labels = dict()
|
||||
# add all suggestions related to each label
|
||||
@ -740,7 +740,7 @@ class PRCodeSuggestions:
|
||||
counter_suggestions = 0
|
||||
for label, suggestions in suggestions_labels.items():
|
||||
num_suggestions = len(suggestions)
|
||||
pr_body += f"""<tr><td rowspan={num_suggestions}>{label.capitalize()}</td>\n"""
|
||||
pr_body += f"""<tr><td rowspan={num_suggestions}><strong>{label.capitalize()}</strong></td>\n"""
|
||||
for i, suggestion in enumerate(suggestions):
|
||||
|
||||
relevant_file = suggestion['relevant_file'].strip()
|
||||
@ -794,19 +794,14 @@ class PRCodeSuggestions:
|
||||
|
||||
{example_code.rstrip()}
|
||||
"""
|
||||
if suggestion.get('score_why'):
|
||||
pr_body += f"<details><summary>Suggestion importance[1-10]: {suggestion['score']}</summary>\n\n"
|
||||
pr_body += f"__\n\nWhy: {suggestion['score_why']}\n\n"
|
||||
pr_body += f"</details>"
|
||||
pr_body += f"<details><summary>Suggestion importance[1-10]: {suggestion['score']}</summary>\n\n"
|
||||
pr_body += f"Why: {suggestion['score_why']}\n\n"
|
||||
pr_body += f"</details>"
|
||||
|
||||
pr_body += f"</details>"
|
||||
|
||||
# # add another column for 'score'
|
||||
score_int = int(suggestion.get('score', 0))
|
||||
score_str = f"{score_int}"
|
||||
if get_settings().pr_code_suggestions.new_score_mechanism:
|
||||
score_str = self.get_score_str(score_int)
|
||||
pr_body += f"</td><td align=center>{score_str}\n\n"
|
||||
pr_body += f"</td><td align=center>{suggestion['score']}\n\n"
|
||||
|
||||
pr_body += f"</td></tr>"
|
||||
counter_suggestions += 1
|
||||
@ -819,16 +814,6 @@ class PRCodeSuggestions:
|
||||
get_logger().info(f"Failed to publish summarized code suggestions, error: {e}")
|
||||
return ""
|
||||
|
||||
def get_score_str(self, score: int) -> str:
|
||||
th_high = get_settings().pr_code_suggestions.get('new_score_mechanism_th_high', 9)
|
||||
th_medium = get_settings().pr_code_suggestions.get('new_score_mechanism_th_medium', 7)
|
||||
if score >= th_high:
|
||||
return "High"
|
||||
elif score >= th_medium:
|
||||
return "Medium"
|
||||
else: # score < 7
|
||||
return "Low"
|
||||
|
||||
async def self_reflect_on_suggestions(self,
|
||||
suggestion_list: List,
|
||||
patches_diff: str,
|
||||
|
Reference in New Issue
Block a user