Update AI handler instantiation in server files

This commit is contained in:
Brian Pham
2023-12-13 08:16:02 +08:00
parent ca1ccd7b91
commit 8fb4a42ef1
16 changed files with 63 additions and 37 deletions

View File

@ -8,7 +8,8 @@ from pr_agent.git_providers import get_git_provider
from pr_agent.tools.pr_code_suggestions import PRCodeSuggestions
from pr_agent.tools.pr_description import PRDescription
from pr_agent.tools.pr_reviewer import PRReviewer
from pr_agent.algo.ai_handlers.litellm_ai_handler import LiteLLMAiHandler
litellm_ai_handler = LiteLLMAiHandler()
async def run_action():
# Get environment variables
@ -83,9 +84,9 @@ async def run_action():
comment_id = event_payload.get("comment", {}).get("id")
provider = get_git_provider()(pr_url=url)
if is_pr:
await PRAgent().handle_request(url, body, notify=lambda: provider.add_eyes_reaction(comment_id))
await PRAgent(ai_handler=litellm_ai_handler).handle_request(url, body, notify=lambda: provider.add_eyes_reaction(comment_id))
else:
await PRAgent().handle_request(url, body)
await PRAgent(ai_handler=litellm_ai_handler).handle_request(url, body)
if __name__ == '__main__':