Conversation
CosmoWorker
commented
Jan 4, 2026
- Made minor changes in the main file with removing unnecessities.
- Add a concise description to readme.
Pull Request SummaryThis PR makes a small set of documentation, code‑clean‑up, and usability improvements:
Overall, the changes do not alter the core functionality of the service; they merely:
Repository Structure (Mermaid)flowchart TD
root[Root Directory] --> README[README.md]
root --> server[server/]
server --> main[main.py]
The diagram reflects the current layout: |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
/review |
| from fastapi import FastAPI, Header | ||
| from fastapi.middleware.cors import CORSMiddleware | ||
| # from fastapi.middleware.cors import CORSMiddleware | ||
| import os | ||
| import logging | ||
| import requests |
There was a problem hiding this comment.
Commenting out the CORSMiddleware import disables CORS handling. Either keep the import and the middleware call if cross‑origin requests are needed, or remove both consistently. Leaving the import commented may cause a NameError later.
|
|
||
| load_dotenv() | ||
| app = FastAPI() | ||
| app.add_middleware(CORSMiddleware) | ||
| # app.add_middleware(CORSMiddleware) | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
| logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s") |
There was a problem hiding this comment.
The middleware registration is also commented out, matching the import removal. Ensure this is intentional; otherwise, re‑enable app.add_middleware(CORSMiddleware) to allow proper CORS support.
| if x_github_event != "pull_request": | ||
| logger.info(f"Ignoring event: {x_github_event}") | ||
| return {"msg": "Ignored- not a PR event"} | ||
|
|
||
| '''Webhook for PR comments, its for giving review comments''' | ||
| if x_github_event == "issue_comment": | ||
| comment_response = payload["issue_comment"]["issue"] | ||
| if ( | ||
| comment_response["pull_request"] | ||
| and comment_response["comment"] == "/review" | ||
| and comment_response["comment"].strip() == "/reviewai" | ||
| ): | ||
| pr_url = comment_response["pull_request"]["url"] | ||
| pr_info = requests.get(pr_url, headers=headers) |
There was a problem hiding this comment.
Triple‑quoted strings are used as block comments, but they create a runtime string literal that is ignored. Replace them with # comments or proper docstrings to avoid unnecessary objects.
| pr_response = payload["pull_request"] | ||
| logger.info("Received Github PR event") | ||
|
|
||
| '''Webhook for Pull request event, It's for Summarization of PR''' | ||
| if pr_response["state"] == "open": | ||
| system_prompt = """You are an Code Summarizer to help Maintainers/Reviewers. Based on the diffs and context provided by the Pull request with additional details, | ||
| you summarize what the PR is about with formatted description if necessary. Changes would be in a table format & related files can be grouped. |
There was a problem hiding this comment.
Same issue as Hunk 3: use # comments for explanatory notes instead of stray string literals.