done i hope
Browse files- .DS_Store +0 -0
- app.py +14 -15
- commitlens.py +7 -0
- index.html +9 -9
.DS_Store
CHANGED
|
Binary files a/.DS_Store and b/.DS_Store differ
|
|
|
app.py
CHANGED
|
@@ -277,44 +277,43 @@ async def homepage():
|
|
| 277 |
|
| 278 |
|
| 279 |
@app.api(name="process_repo")
|
| 280 |
-
@spaces.GPU(duration=240)
|
| 281 |
def process_repo(repo_url: str, token: str) -> dict:
|
| 282 |
"""
|
| 283 |
Full pipeline:
|
| 284 |
-
1. run_pipeline() β
|
| 285 |
-
2. Mellum 2
|
| 286 |
-
3. Groq 70B β final markdown
|
| 287 |
|
| 288 |
Returns: { "files": [{"name": str, "summary": str}], "report": str }
|
| 289 |
"""
|
| 290 |
log.info("=== process_repo: %s ===", repo_url)
|
| 291 |
-
_model.to("cuda") # move model to GPU for Mellum inference
|
| 292 |
-
|
|
|
|
| 293 |
prompts = run_pipeline(repo_url, token.strip() or None)
|
| 294 |
-
log.info("Got %d file prompts from pipeline", len(prompts))
|
| 295 |
if not prompts:
|
| 296 |
-
raise ValueError("No source-code files changed in the latest commit.")
|
| 297 |
|
| 298 |
fnames = [_extract_filename(p) for p in prompts]
|
| 299 |
|
| 300 |
-
# Step 2 β
|
| 301 |
mellum_prompts = [_build_mellum_prompt(p) for p in prompts]
|
| 302 |
-
summaries =
|
| 303 |
|
| 304 |
file_results = [
|
| 305 |
{"name": n, "summary": s}
|
| 306 |
for n, s in zip(fnames, summaries)
|
| 307 |
]
|
| 308 |
-
log.info("
|
| 309 |
|
| 310 |
-
# Step 3 β
|
| 311 |
-
# context β that's fine, the Groq call is pure HTTP and doesn't touch CUDA)
|
| 312 |
final_report = _generate_final_report_groq(file_results)
|
| 313 |
|
| 314 |
-
log.info("Pipeline complete β %d files", len(file_results))
|
| 315 |
return {"files": file_results, "report": final_report}
|
| 316 |
|
| 317 |
-
|
| 318 |
# ---------------------------------------------------------------------------
|
| 319 |
# Boot
|
| 320 |
# ---------------------------------------------------------------------------
|
|
|
|
| 277 |
|
| 278 |
|
| 279 |
@app.api(name="process_repo")
|
| 280 |
+
@spaces.GPU(duration=240)
|
| 281 |
def process_repo(repo_url: str, token: str) -> dict:
|
| 282 |
"""
|
| 283 |
Full pipeline:
|
| 284 |
+
1. run_pipeline() β Top 2 most changed file prompts (CPU, fast)
|
| 285 |
+
2. Mellum 2 sequential β per-file summaries (.md format) (GPU, sequential)
|
| 286 |
+
3. Groq 70B β final markdown summary report (API, ~3 s)
|
| 287 |
|
| 288 |
Returns: { "files": [{"name": str, "summary": str}], "report": str }
|
| 289 |
"""
|
| 290 |
log.info("=== process_repo: %s ===", repo_url)
|
| 291 |
+
_model.to("cuda") # move model to GPU for Mellum inference
|
| 292 |
+
|
| 293 |
+
# Step 1 β fetch diff and build prompts (Now limited to top 2 files from commitlens.py)
|
| 294 |
prompts = run_pipeline(repo_url, token.strip() or None)
|
| 295 |
+
log.info("Got %d file prompts from pipeline (capped at top 2)", len(prompts))
|
| 296 |
if not prompts:
|
| 297 |
+
raise ValueError("No matching source-code files changed in the latest commit.")
|
| 298 |
|
| 299 |
fnames = [_extract_filename(p) for p in prompts]
|
| 300 |
|
| 301 |
+
# Step 2 β Force sequential execution through Mellum 2 on GPU
|
| 302 |
mellum_prompts = [_build_mellum_prompt(p) for p in prompts]
|
| 303 |
+
summaries = _generate_sequential(mellum_prompts)
|
| 304 |
|
| 305 |
file_results = [
|
| 306 |
{"name": n, "summary": s}
|
| 307 |
for n, s in zip(fnames, summaries)
|
| 308 |
]
|
| 309 |
+
log.info("Sequential per-file summaries done")
|
| 310 |
|
| 311 |
+
# Step 3 β Send the 2 .md summaries to Groq for final summary generation
|
|
|
|
| 312 |
final_report = _generate_final_report_groq(file_results)
|
| 313 |
|
| 314 |
+
log.info("Pipeline complete β processed top %d files", len(file_results))
|
| 315 |
return {"files": file_results, "report": final_report}
|
| 316 |
|
|
|
|
| 317 |
# ---------------------------------------------------------------------------
|
| 318 |
# Boot
|
| 319 |
# ---------------------------------------------------------------------------
|
commitlens.py
CHANGED
|
@@ -232,6 +232,13 @@ def fetch_commit_context(
|
|
| 232 |
# Step 4 β filter files
|
| 233 |
filtered: list[dict] = [f for f in raw_files if _should_keep(f["filename"])]
|
| 234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
# Step 5 + 6 β build FileContext, fetch before/after content
|
| 236 |
file_contexts: list[FileContext] = []
|
| 237 |
for f in filtered:
|
|
|
|
| 232 |
# Step 4 β filter files
|
| 233 |
filtered: list[dict] = [f for f in raw_files if _should_keep(f["filename"])]
|
| 234 |
|
| 235 |
+
# --- NEW: Sort by total changes (additions + deletions) descending and take top 2 ---
|
| 236 |
+
filtered = sorted(
|
| 237 |
+
filtered,
|
| 238 |
+
key=lambda x: x.get("additions", 0) + x.get("deletions", 0),
|
| 239 |
+
reverse=True
|
| 240 |
+
)[:2]
|
| 241 |
+
|
| 242 |
# Step 5 + 6 β build FileContext, fetch before/after content
|
| 243 |
file_contexts: list[FileContext] = []
|
| 244 |
for f in filtered:
|
index.html
CHANGED
|
@@ -56,27 +56,27 @@ canvas{position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index
|
|
| 56 |
.status.error{color:#f85149}
|
| 57 |
|
| 58 |
/* ββ Output area ββ */
|
| 59 |
-
.out-area{display:flex;flex-direction:column;gap:0;min-height:
|
| 60 |
.tabs{display:flex;gap:0;border-bottom:0.5px solid #0e0e18;margin-bottom:14px}
|
| 61 |
-
.tb{font-size:
|
| 62 |
.tb.on{color:#58a6ff;border-bottom-color:#58a6ff}
|
| 63 |
|
| 64 |
/* Per-file pane */
|
| 65 |
#pane-f{display:none}
|
| 66 |
-
#pane-f.on{display:block;max-height:
|
| 67 |
.frow{display:flex;align-items:flex-start;gap:9px;padding:8px 0;border-bottom:0.5px solid #0b0b14;cursor:pointer;transition:background .1s;border-radius:4px}
|
| 68 |
.frow:last-child{border:none}
|
| 69 |
.frow:hover{background:#0d0d18}
|
| 70 |
.dot{width:5px;height:5px;border-radius:50%;flex-shrink:0;margin-top:3px}
|
| 71 |
.file-body{display:flex;flex-direction:column;gap:3px;flex:1;min-width:0}
|
| 72 |
-
.fn{font-size:
|
| 73 |
-
.fd{font-size:
|
| 74 |
-
.fd.expanded{color:#
|
| 75 |
|
| 76 |
/* Report pane */
|
| 77 |
#pane-r{display:none}
|
| 78 |
-
#pane-r.on{display:block;max-height:
|
| 79 |
-
.rp{font-size:
|
| 80 |
.rp em{color:#58a6ff;font-style:normal}
|
| 81 |
|
| 82 |
/* Empty state */
|
|
@@ -460,4 +460,4 @@ document.getElementById('ri').addEventListener('keydown', e => {
|
|
| 460 |
});
|
| 461 |
</script>
|
| 462 |
</body>
|
| 463 |
-
</html>
|
|
|
|
| 56 |
.status.error{color:#f85149}
|
| 57 |
|
| 58 |
/* ββ Output area ββ */
|
| 59 |
+
.out-area{display:flex;flex-direction:column;gap:0;min-height:320px;background:rgba(10,10,20,.75);border:1px solid #1f2937;border-radius:12px;padding:14px;margin-top:8px}
|
| 60 |
.tabs{display:flex;gap:0;border-bottom:0.5px solid #0e0e18;margin-bottom:14px}
|
| 61 |
+
.tb{font-size:10px;letter-spacing:.16em;color:#8b949e;cursor:pointer;padding-bottom:10px;margin-right:22px;border-bottom:1px solid transparent;transition:color .15s;text-transform:uppercase;background:none;border-top:none;border-left:none;border-right:none;font-family:'Space Mono',monospace}
|
| 62 |
.tb.on{color:#58a6ff;border-bottom-color:#58a6ff}
|
| 63 |
|
| 64 |
/* Per-file pane */
|
| 65 |
#pane-f{display:none}
|
| 66 |
+
#pane-f.on{display:block;max-height:420px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#30363d transparent}
|
| 67 |
.frow{display:flex;align-items:flex-start;gap:9px;padding:8px 0;border-bottom:0.5px solid #0b0b14;cursor:pointer;transition:background .1s;border-radius:4px}
|
| 68 |
.frow:last-child{border:none}
|
| 69 |
.frow:hover{background:#0d0d18}
|
| 70 |
.dot{width:5px;height:5px;border-radius:50%;flex-shrink:0;margin-top:3px}
|
| 71 |
.file-body{display:flex;flex-direction:column;gap:3px;flex:1;min-width:0}
|
| 72 |
+
.fn{font-size:12px;color:#e6edf3;letter-spacing:.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:700}
|
| 73 |
+
.fd{font-size:11px;color:#b8c5d6;font-style:italic;line-height:1.7;white-space:pre-wrap;word-break:break-word}
|
| 74 |
+
.fd.expanded{color:#d7e3f4}
|
| 75 |
|
| 76 |
/* Report pane */
|
| 77 |
#pane-r{display:none}
|
| 78 |
+
#pane-r.on{display:block;max-height:420px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#30363d transparent}
|
| 79 |
+
.rp{font-size:12px;color:#d6dee8;line-height:1.9;white-space:pre-wrap;word-break:break-word}
|
| 80 |
.rp em{color:#58a6ff;font-style:normal}
|
| 81 |
|
| 82 |
/* Empty state */
|
|
|
|
| 460 |
});
|
| 461 |
</script>
|
| 462 |
</body>
|
| 463 |
+
</html>
|