mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 12:50:38 +08:00
ask
This commit is contained in:
@ -40,6 +40,11 @@ CodiumAI PR-Agent aims to help efficiently review and handle pull requests, by p
|
|||||||
|
|
||||||
## News and Updates
|
## News and Updates
|
||||||
|
|
||||||
|
### April 14, 2024
|
||||||
|
You can now ask questions about images that appear in the comment, where the entire PR is considered as the context.
|
||||||
|
see [here](https://pr-agent-docs.codium.ai/tools/ask/#ask-on-images-using-the-pr-code-as-context).
|
||||||
|
{width=512}
|
||||||
|
|
||||||
### March 24, 2024
|
### March 24, 2024
|
||||||
PR-Agent is now available for easy installation via [pip](https://pr-agent-docs.codium.ai/installation/locally/#using-pip-package).
|
PR-Agent is now available for easy installation via [pip](https://pr-agent-docs.codium.ai/installation/locally/#using-pip-package).
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import requests
|
||||||
import boto3
|
import boto3
|
||||||
import litellm
|
import litellm
|
||||||
import openai
|
import openai
|
||||||
@ -110,12 +110,16 @@ class LiteLLMAIHandler(BaseAiHandler):
|
|||||||
model = 'azure/' + model
|
model = 'azure/' + model
|
||||||
messages = [{"role": "system", "content": system}, {"role": "user", "content": user}]
|
messages = [{"role": "system", "content": system}, {"role": "user", "content": user}]
|
||||||
if img_path:
|
if img_path:
|
||||||
import requests
|
try:
|
||||||
r = requests.get(img_path, allow_redirects=True)
|
# check if the image link is alive
|
||||||
|
r = requests.head(img_path, allow_redirects=True)
|
||||||
if r.status_code == 404:
|
if r.status_code == 404:
|
||||||
error_msg = f"The image link is not [alive](img_path).\nPlease repost the original image as a comment, and send the question again with 'quote reply' (see [instructions](https://pr-agent-docs.codium.ai/tools/ask/#ask-on-images-using-the-pr-code-as-context))."
|
error_msg = f"The image link is not [alive](img_path).\nPlease repost the original image as a comment, and send the question again with 'quote reply' (see [instructions](https://pr-agent-docs.codium.ai/tools/ask/#ask-on-images-using-the-pr-code-as-context))."
|
||||||
get_logger().error(error_msg)
|
get_logger().error(error_msg)
|
||||||
return f"{error_msg}", "error"
|
return f"{error_msg}", "error"
|
||||||
|
except Exception as e:
|
||||||
|
get_logger().error(f"Error fetching image: {img_path}", e)
|
||||||
|
return f"Error fetching image: {img_path}", "error"
|
||||||
messages[1]["content"] = [{"type": "text", "text": messages[1]["content"]},
|
messages[1]["content"] = [{"type": "text", "text": messages[1]["content"]},
|
||||||
{"type": "image_url", "image_url": {"url": img_path}}]
|
{"type": "image_url", "image_url": {"url": img_path}}]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user