Autoreview-AI / app.py
Krishp1's picture
Update app.py
2598145 verified
Raw
History Blame Contribute Delete
2.42 kB
# app.py β€” Streamlit UI for AutoReview AI
import streamlit as st
from main import review_pr_simple
# ── PAGE CONFIG ───────────────────────────
st.set_page_config(
page_title="AutoReview AI",
page_icon="πŸ€–",
layout="centered"
)
# ── TITLE ─────────────────────────────────
st.title("πŸ€– AutoReview AI")
st.markdown("*Autonomous GitHub PR Reviewer powered by LLaMA + Groq*")
st.divider()
# ── INPUT ─────────────────────────────────
pr_url = st.text_input(
"Enter GitHub PR URL",
placeholder="https://github.com/owner/repo/pull/123"
)
github_token = st.text_input(
"GitHub Personal Access Token (Optional)",
type="password",
placeholder="ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
help="Required only for private repositories. Leave blank for public repositories."
)
# ── BUTTON ────────────────────────────────
if st.button("πŸ” Review PR", type="primary"):
# check if URL is empty
if not pr_url:
st.warning("Please enter a PR URL first!")
else:
# show spinner while reviewing
with st.spinner("πŸ€– Reviewing PR... this may take 30 seconds"):
try:
result = review_pr_simple(
pr_url=pr_url,
github_token=github_token or None
)
except Exception as e:
result = {"success": False, "error": f"Unexpected error: {str(e)}"}
# if success
if result["success"]:
st.success("βœ… Review Complete!")
st.divider()
# show PR data
st.subheader("πŸ“‹ PR Summary")
st.code(result["pr_data"][:500])
# show analysis
st.subheader("πŸ” Code Analysis")
st.write(result["analysis"])
# show verdict
st.subheader("βœ… Final Verdict")
st.write(result["verdict"])
# if failed
else:
st.error(f"❌ Failed: {result['error']}")
# ── FOOTER ────────────────────────────────
st.divider()
st.caption("Built with LangChain + Groq + Streamlit")