Review Agent: Removed the pdf export
Browse files- Dockerfile +0 -1
- README.md +4 -8
- requirements.txt +1 -5
- src/services/report_generator.py +12 -38
- src/ui/components/export_manager.py +0 -6
Dockerfile
CHANGED
@@ -13,7 +13,6 @@ WORKDIR /app
|
|
13 |
# Install system dependencies
|
14 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
15 |
git \
|
16 |
-
wkhtmltopdf \
|
17 |
&& apt-get clean \
|
18 |
&& rm -rf /var/lib/apt/lists/*
|
19 |
|
|
|
13 |
# Install system dependencies
|
14 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
15 |
git \
|
|
|
16 |
&& apt-get clean \
|
17 |
&& rm -rf /var/lib/apt/lists/*
|
18 |
|
README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
---
|
2 |
title: Code Review Agent
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 5.33.
|
8 |
app_file: app.py
|
9 |
pinned: true
|
10 |
short_description: An AI-powered code review agent that analyzes Github Repos
|
@@ -110,18 +110,14 @@ python -m pytest tests/
|
|
110 |
## π Project Structure
|
111 |
|
112 |
```
|
113 |
-
βββ .env # Environment variables configuration
|
114 |
βββ .gitignore # Git ignore file
|
115 |
-
βββ DEPLOYMENT_GUIDE.md # Guide for deploying to Hugging Face and Modal
|
116 |
βββ Dockerfile # Docker configuration
|
117 |
βββ LICENSE # MIT License file
|
118 |
βββ README.md # Project documentation
|
119 |
βββ app.py # Entry point for Hugging Face Spaces
|
120 |
βββ docker-compose.yml # Docker Compose configuration
|
121 |
βββ modal_deploy.py # Modal deployment configuration
|
122 |
-
βββ prompt.txt # AI prompt templates
|
123 |
βββ requirements.txt # Python dependencies
|
124 |
-
βββ run.py # Alternative entry script
|
125 |
βββ sample.env # Sample environment variables
|
126 |
βββ setup.py # Package setup configuration
|
127 |
βββ src/ # Source code directory
|
|
|
1 |
---
|
2 |
title: Code Review Agent
|
3 |
+
emoji: π
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: blue
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 5.33.1
|
8 |
app_file: app.py
|
9 |
pinned: true
|
10 |
short_description: An AI-powered code review agent that analyzes Github Repos
|
|
|
110 |
## π Project Structure
|
111 |
|
112 |
```
|
|
|
113 |
βββ .gitignore # Git ignore file
|
|
|
114 |
βββ Dockerfile # Docker configuration
|
115 |
βββ LICENSE # MIT License file
|
116 |
βββ README.md # Project documentation
|
117 |
βββ app.py # Entry point for Hugging Face Spaces
|
118 |
βββ docker-compose.yml # Docker Compose configuration
|
119 |
βββ modal_deploy.py # Modal deployment configuration
|
|
|
120 |
βββ requirements.txt # Python dependencies
|
|
|
121 |
βββ sample.env # Sample environment variables
|
122 |
βββ setup.py # Package setup configuration
|
123 |
βββ src/ # Source code directory
|
requirements.txt
CHANGED
@@ -30,8 +30,4 @@ memory-profiler # Memory profiling
|
|
30 |
openai # OpenAI API client for Nebius integration
|
31 |
|
32 |
# Deployment
|
33 |
-
modal
|
34 |
-
|
35 |
-
|
36 |
-
pdfkit
|
37 |
-
wkhtmltopdf
|
|
|
30 |
openai # OpenAI API client for Nebius integration
|
31 |
|
32 |
# Deployment
|
33 |
+
modal
|
|
|
|
|
|
|
|
src/services/report_generator.py
CHANGED
@@ -14,7 +14,6 @@ import logging
|
|
14 |
import datetime
|
15 |
from pathlib import Path
|
16 |
import markdown
|
17 |
-
import pdfkit
|
18 |
import csv
|
19 |
|
20 |
logger = logging.getLogger(__name__)
|
@@ -31,9 +30,16 @@ class ReportGenerator:
|
|
31 |
Args:
|
32 |
output_dir (str): Directory to save generated reports.
|
33 |
"""
|
34 |
-
|
35 |
-
os.
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
def generate_report(self, repo_name, results, format_type="all"):
|
39 |
"""
|
@@ -42,7 +48,7 @@ class ReportGenerator:
|
|
42 |
Args:
|
43 |
repo_name (str): Name of the repository.
|
44 |
results (dict): Analysis results.
|
45 |
-
format_type (str): Report format type (json, html,
|
46 |
|
47 |
Returns:
|
48 |
dict: Paths to the generated reports.
|
@@ -63,10 +69,6 @@ class ReportGenerator:
|
|
63 |
html_path = self._generate_html_report(report_name, report_content)
|
64 |
report_paths["html"] = html_path
|
65 |
|
66 |
-
if format_type in ["pdf", "all"]:
|
67 |
-
pdf_path = self._generate_pdf_report(report_name, report_content)
|
68 |
-
report_paths["pdf"] = pdf_path
|
69 |
-
|
70 |
if format_type in ["csv", "all"]:
|
71 |
csv_path = self._generate_csv_report(report_name, report_content)
|
72 |
report_paths["csv"] = csv_path
|
@@ -516,35 +518,7 @@ class ReportGenerator:
|
|
516 |
logger.info(f"Generated HTML report: {report_path}")
|
517 |
return report_path
|
518 |
|
519 |
-
|
520 |
-
"""
|
521 |
-
Generate a PDF report.
|
522 |
-
|
523 |
-
Args:
|
524 |
-
report_name (str): Name of the report.
|
525 |
-
report_content (dict): Report content.
|
526 |
-
|
527 |
-
Returns:
|
528 |
-
str: Path to the generated report.
|
529 |
-
"""
|
530 |
-
report_path = os.path.join(self.output_dir, f"{report_name}.pdf")
|
531 |
-
|
532 |
-
# First generate HTML report
|
533 |
-
html_path = self._generate_html_report(f"{report_name}_temp", report_content)
|
534 |
-
|
535 |
-
try:
|
536 |
-
# Convert HTML to PDF using pdfkit
|
537 |
-
pdfkit.from_file(html_path, report_path)
|
538 |
-
|
539 |
-
# Remove temporary HTML file
|
540 |
-
os.remove(html_path)
|
541 |
-
|
542 |
-
logger.info(f"Generated PDF report: {report_path}")
|
543 |
-
return report_path
|
544 |
-
|
545 |
-
except Exception as e:
|
546 |
-
logger.error(f"Error generating PDF report: {e}")
|
547 |
-
return html_path
|
548 |
|
549 |
def _generate_csv_report(self, report_name, report_content):
|
550 |
"""
|
|
|
14 |
import datetime
|
15 |
from pathlib import Path
|
16 |
import markdown
|
|
|
17 |
import csv
|
18 |
|
19 |
logger = logging.getLogger(__name__)
|
|
|
30 |
Args:
|
31 |
output_dir (str): Directory to save generated reports.
|
32 |
"""
|
33 |
+
# Use absolute path for output directory
|
34 |
+
if not os.path.isabs(output_dir):
|
35 |
+
# Get the absolute path relative to the project root
|
36 |
+
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
|
37 |
+
self.output_dir = os.path.join(project_root, output_dir)
|
38 |
+
else:
|
39 |
+
self.output_dir = output_dir
|
40 |
+
|
41 |
+
os.makedirs(self.output_dir, exist_ok=True)
|
42 |
+
logger.info(f"Initialized ReportGenerator with output directory: {self.output_dir}")
|
43 |
|
44 |
def generate_report(self, repo_name, results, format_type="all"):
|
45 |
"""
|
|
|
48 |
Args:
|
49 |
repo_name (str): Name of the repository.
|
50 |
results (dict): Analysis results.
|
51 |
+
format_type (str): Report format type (json, html, csv, or all).
|
52 |
|
53 |
Returns:
|
54 |
dict: Paths to the generated reports.
|
|
|
69 |
html_path = self._generate_html_report(report_name, report_content)
|
70 |
report_paths["html"] = html_path
|
71 |
|
|
|
|
|
|
|
|
|
72 |
if format_type in ["csv", "all"]:
|
73 |
csv_path = self._generate_csv_report(report_name, report_content)
|
74 |
report_paths["csv"] = csv_path
|
|
|
518 |
logger.info(f"Generated HTML report: {report_path}")
|
519 |
return report_path
|
520 |
|
521 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
|
523 |
def _generate_csv_report(self, report_name, report_content):
|
524 |
"""
|
src/ui/components/export_manager.py
CHANGED
@@ -27,12 +27,6 @@ def create_export_manager():
|
|
27 |
gr.Markdown("### π€ Export Results")
|
28 |
|
29 |
with gr.Row():
|
30 |
-
# PDF Export
|
31 |
-
pdf_btn = gr.Button("Export as PDF", variant="secondary")
|
32 |
-
pdf_format = gr.Textbox(value="pdf", visible=False)
|
33 |
-
export_buttons.append((pdf_btn, pdf_format))
|
34 |
-
export_formats.append(pdf_format)
|
35 |
-
|
36 |
# JSON Export
|
37 |
json_btn = gr.Button("Export as JSON", variant="secondary")
|
38 |
json_format = gr.Textbox(value="json", visible=False)
|
|
|
27 |
gr.Markdown("### π€ Export Results")
|
28 |
|
29 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
# JSON Export
|
31 |
json_btn = gr.Button("Export as JSON", variant="secondary")
|
32 |
json_format = gr.Textbox(value="json", visible=False)
|