mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 21:00:40 +08:00
Merge pull request #1130 from Codium-ai/tr/err_protections
Tr/err protections
This commit is contained in:
@ -106,6 +106,10 @@ class LiteLLMAIHandler(BaseAiHandler):
|
|||||||
deployment_id = self.deployment_id
|
deployment_id = self.deployment_id
|
||||||
if self.azure:
|
if self.azure:
|
||||||
model = 'azure/' + model
|
model = 'azure/' + model
|
||||||
|
if 'claude' in model and not system:
|
||||||
|
system = "\n"
|
||||||
|
get_logger().warning(
|
||||||
|
"Empty system prompt for claude model. Adding a newline character to prevent OpenAI API error.")
|
||||||
messages = [{"role": "system", "content": system}, {"role": "user", "content": user}]
|
messages = [{"role": "system", "content": system}, {"role": "user", "content": user}]
|
||||||
if img_path:
|
if img_path:
|
||||||
try:
|
try:
|
||||||
|
@ -147,7 +147,7 @@ def convert_to_markdown_v2(output_data: dict,
|
|||||||
else:
|
else:
|
||||||
markdown_text += f"### {emoji} {key_nice}: {value}\n\n"
|
markdown_text += f"### {emoji} {key_nice}: {value}\n\n"
|
||||||
elif 'relevant tests' in key_nice.lower():
|
elif 'relevant tests' in key_nice.lower():
|
||||||
value = value.strip().lower()
|
value = str(value).strip().lower()
|
||||||
if gfm_supported:
|
if gfm_supported:
|
||||||
markdown_text += f"<tr><td>"
|
markdown_text += f"<tr><td>"
|
||||||
if is_value_no(value):
|
if is_value_no(value):
|
||||||
@ -674,14 +674,16 @@ def get_user_labels(current_labels: List[str] = None):
|
|||||||
Only keep labels that has been added by the user
|
Only keep labels that has been added by the user
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
enable_custom_labels = get_settings().config.get('enable_custom_labels', False)
|
||||||
|
custom_labels = get_settings().get('custom_labels', [])
|
||||||
if current_labels is None:
|
if current_labels is None:
|
||||||
current_labels = []
|
current_labels = []
|
||||||
user_labels = []
|
user_labels = []
|
||||||
for label in current_labels:
|
for label in current_labels:
|
||||||
if label.lower() in ['bug fix', 'tests', 'enhancement', 'documentation', 'other']:
|
if label.lower() in ['bug fix', 'tests', 'enhancement', 'documentation', 'other']:
|
||||||
continue
|
continue
|
||||||
if get_settings().config.enable_custom_labels:
|
if enable_custom_labels:
|
||||||
if label in get_settings().custom_labels:
|
if label in custom_labels:
|
||||||
continue
|
continue
|
||||||
user_labels.append(label)
|
user_labels.append(label)
|
||||||
if user_labels:
|
if user_labels:
|
||||||
|
Reference in New Issue
Block a user