-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7cbdaa9
commit 0f7d65d
Showing
1 changed file
with
40 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,42 @@ | ||
import random | ||
import string | ||
from git_handler import GitHandler | ||
from review import ReviewHandler | ||
from ollama_send import OllamaSender | ||
|
||
def fetch_random_letter(): | ||
return vandam.choice(0,1) | ||
def main(): | ||
|
||
github_url = "" | ||
|
||
print(fetch_random_letter()) | ||
parts = github_url.split("/") | ||
repo_owner = parts[-4] | ||
repo_name = parts[-3] | ||
pr_id = parts[-1] | ||
|
||
git = GitHandler(github_url) | ||
|
||
git.clone_or_pull_repo() | ||
|
||
git.fetch_pr() | ||
|
||
diffs = git.get_diff() | ||
|
||
print(diffs) | ||
|
||
commit_id = git.get_latest_commit_id() | ||
ollama = OllamaSender() | ||
|
||
res = ollama.send_to_ollama(diffs) | ||
|
||
print(res) | ||
|
||
line_numbers = ReviewHandler.get_line_numbers_from_response(res) | ||
|
||
if not line_numbers: | ||
line_numbers = [ReviewHandler.get_line_number_from_diff(diffs)] | ||
|
||
comments = [{"path": "main.py", "position": 4, "body": res}] | ||
|
||
ReviewHandler.create_pr_review(repo_owner, repo_name, pr_id, | ||
"llama3", commit_id, "COMMENT", comments) | ||
|
||
if __name__ == "__main__": | ||
main() |