Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# AI-Code-Context-Reviewer
Automated code review bot using AI.

## Python Dependency Management ( using `uv` )
Install `uv`: ( official site: [uv Installation Reference↗](https://docs.astral.sh/uv/getting-started/installation/))
Expand All @@ -9,4 +10,12 @@ Install dependencies (app with `pyproject.toml`):
```bash
cd $server
uv install
```
```
## Features
* Reviews based on Ruleset defined in `rules.txt`
* Simple Deployment via Vercel

## Tools/Libraries
* Groq
* Fastapi
* Vercel (for Deployement url)
12 changes: 4 additions & 8 deletions server/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
# from fastapi.middleware.cors import CORSMiddleware
import os
import logging
import requests
Comment on lines 1 to 5
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of commenting out the import, remove the line entirely to avoid dead code and keep imports clean.

Expand All @@ -10,7 +10,7 @@

load_dotenv()
app = FastAPI()
app.add_middleware(CORSMiddleware)
# app.add_middleware(CORSMiddleware) # not required

logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
Comment on lines 10 to 16
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If CORS middleware is not required, delete the commented line instead of leaving dead code.

Expand Down Expand Up @@ -184,6 +184,7 @@ def handle_pr_event(payload: dict):
)
logger.info("Base commit file received")
hunks_diff = hunks_per_diff(diffs)
logger.info("formatting some hunks")
user_prompt = f"""
Context(Base commit Files):
{base_commit_filecontent}
Expand Down Expand Up @@ -235,15 +236,10 @@ def handle_pr_event(payload: dict):
requests.post(
pr_response["review_comments_url"], json=payload, headers=headers
)

logger.info("Posted comment....")
return {"msg": "Review Check Done"}


# @app.post("/webhook-comment") # some other endpoint name
# def handle_issue_comment_event():
# pass


if __name__ == "__main__":
main()

Expand Down