CodeCommunity commited on
Commit
fb9e94f
·
verified ·
1 Parent(s): 5258830

Update app/main.py

Browse files
Files changed (1) hide show
  1. 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
- # 1. Convert Pydantic models to dicts (Works for both Pydantic V1 & V2)
65
- payload = []
66
- for item in file_list:
67
- if hasattr(item, "model_dump"):
68
- payload.append(item.model_dump()) # Pydantic v2
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(payload)
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: