Spaces:
Sleeping
Sleeping
Update app/main.py
Browse files- app/main.py +6 -17
app/main.py
CHANGED
|
@@ -61,24 +61,13 @@ def calculate_repo_health(total_vulns: int, avg_maint: float) -> int:
|
|
| 61 |
return int(max(10, min(100, base_score - penalty)))
|
| 62 |
|
| 63 |
def sync_review_worker(file_list: List[FileRequest]):
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
else:
|
| 70 |
-
payload.append(item.dict()) # Pydantic v1
|
| 71 |
-
|
| 72 |
-
# 2. Add debug logs to verify content exists before calling service
|
| 73 |
-
logger.info(f"--- [DEBUG] Processing {len(payload)} files for code review ---")
|
| 74 |
-
for file_dict in payload:
|
| 75 |
-
name = file_dict.get("fileName", "Unknown")
|
| 76 |
-
content_len = len(file_dict.get("content") or "")
|
| 77 |
-
logger.info(f"File: {name} | Content length: {content_len} chars")
|
| 78 |
-
|
| 79 |
-
# 3. Call your review service with converted dicts
|
| 80 |
try:
|
| 81 |
-
results = reviewer.service.review_batch_code(
|
| 82 |
logger.info(f"--- [DEBUG] Reviewer Output: {results} ---")
|
| 83 |
return results
|
| 84 |
except Exception as e:
|
|
|
|
| 61 |
return int(max(10, min(100, base_score - penalty)))
|
| 62 |
|
| 63 |
def sync_review_worker(file_list: List[FileRequest]):
|
| 64 |
+
logger.info(f"--- [DEBUG] Processing {len(file_list)} files for code review ---")
|
| 65 |
+
for f in file_list:
|
| 66 |
+
content_len = len(f.content or "")
|
| 67 |
+
logger.info(f"File: {f.fileName} | Content length: {content_len} chars")
|
| 68 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
try:
|
| 70 |
+
results = reviewer.service.review_batch_code(file_list)
|
| 71 |
logger.info(f"--- [DEBUG] Reviewer Output: {results} ---")
|
| 72 |
return results
|
| 73 |
except Exception as e:
|