Spaces:
Sleeping
Sleeping
Update app
Browse files- app/__pycache__/detector.cpython-312.pyc +0 -0
- app/detector.py +9 -2
- static/app.js +4 -4
- static/styles.css +1 -0
app/__pycache__/detector.cpython-312.pyc
CHANGED
|
Binary files a/app/__pycache__/detector.cpython-312.pyc and b/app/__pycache__/detector.cpython-312.pyc differ
|
|
|
app/detector.py
CHANGED
|
@@ -638,8 +638,14 @@ class CodeSimilarityAnalyzer:
|
|
| 638 |
|
| 639 |
def generate_agent_report(analysis_results: dict) -> str:
|
| 640 |
lines = [
|
| 641 |
-
"### MODULAR RECONSTRUCTION SPECIFICATION",
|
| 642 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 643 |
"",
|
| 644 |
]
|
| 645 |
overall = analysis_results.get("overall", [])
|
|
@@ -677,6 +683,7 @@ def generate_agent_report(analysis_results: dict) -> str:
|
|
| 677 |
lines.append(
|
| 678 |
f"- `{query_name}` is near-identical to `{top['match_name']}` in `{top['relative_path']}`."
|
| 679 |
)
|
|
|
|
| 680 |
|
| 681 |
lines.append("\n#### 3. PROMPT STARTER")
|
| 682 |
lines.append("```text")
|
|
|
|
| 638 |
|
| 639 |
def generate_agent_report(analysis_results: dict) -> str:
|
| 640 |
lines = [
|
| 641 |
+
"### MODULAR RECONSTRUCTION SPECIFICATION (FOR AGENT)",
|
| 642 |
+
"You are operating inside the Transformers repository. Your task is to produce a `modular_*.py` file that",
|
| 643 |
+
"maximizes reuse of existing Transformers components.",
|
| 644 |
+
"Purpose: the `modular_model_converter.py` script reads the modular file, resolves inheritance, and",
|
| 645 |
+
"generates the final `modeling_*.py` file. The modular file should prefer inheriting from existing",
|
| 646 |
+
"Transformers classes (e.g., attention, MLP, blocks, model heads) rather than starting fresh from",
|
| 647 |
+
"`nn.Module`, so the generated model shares as much code as possible and only overrides the minimal deltas.",
|
| 648 |
+
"Use this report to choose those base classes and to decide where custom logic is actually required.",
|
| 649 |
"",
|
| 650 |
]
|
| 651 |
overall = analysis_results.get("overall", [])
|
|
|
|
| 683 |
lines.append(
|
| 684 |
f"- `{query_name}` is near-identical to `{top['match_name']}` in `{top['relative_path']}`."
|
| 685 |
)
|
| 686 |
+
lines.append(" Read both methods and reuse as much as possible through modular inheritance.")
|
| 687 |
|
| 688 |
lines.append("\n#### 3. PROMPT STARTER")
|
| 689 |
lines.append("```text")
|
static/app.js
CHANGED
|
@@ -88,9 +88,9 @@ function setAst(queryAst, matchAst, querySummary, matchSummary) {
|
|
| 88 |
astMatchSummaryEl.textContent = formatSummary(matchSummary);
|
| 89 |
}
|
| 90 |
if (flowComparisonEl) {
|
| 91 |
-
const queryFlow = querySummary?.flow ?
|
| 92 |
-
const matchFlow = matchSummary?.flow ?
|
| 93 |
-
flowComparisonEl.textContent = `${queryFlow}
|
| 94 |
}
|
| 95 |
}
|
| 96 |
|
|
@@ -199,7 +199,7 @@ function renderBlueprint(byClass) {
|
|
| 199 |
item.addEventListener("click", () => {
|
| 200 |
document.querySelectorAll(".blueprint-item").forEach((el) => el.classList.remove("is-active"));
|
| 201 |
item.classList.add("is-active");
|
| 202 |
-
const matchIdentifier = top.
|
| 203 |
const activeName = document.getElementById("activeModuleName");
|
| 204 |
if (activeName) {
|
| 205 |
activeName.textContent = `${qcls} vs ${top.class_name}`;
|
|
|
|
| 88 |
astMatchSummaryEl.textContent = formatSummary(matchSummary);
|
| 89 |
}
|
| 90 |
if (flowComparisonEl) {
|
| 91 |
+
const queryFlow = querySummary?.flow ? querySummary.flow : "unavailable";
|
| 92 |
+
const matchFlow = matchSummary?.flow ? matchSummary.flow : "unavailable";
|
| 93 |
+
flowComparisonEl.textContent = `Selected flow:\n${queryFlow}\n\nMatch flow:\n${matchFlow}`;
|
| 94 |
}
|
| 95 |
}
|
| 96 |
|
|
|
|
| 199 |
item.addEventListener("click", () => {
|
| 200 |
document.querySelectorAll(".blueprint-item").forEach((el) => el.classList.remove("is-active"));
|
| 201 |
item.classList.add("is-active");
|
| 202 |
+
const matchIdentifier = top.identifier;
|
| 203 |
const activeName = document.getElementById("activeModuleName");
|
| 204 |
if (activeName) {
|
| 205 |
activeName.textContent = `${qcls} vs ${top.class_name}`;
|
static/styles.css
CHANGED
|
@@ -274,6 +274,7 @@ textarea {
|
|
| 274 |
padding: 8px 12px;
|
| 275 |
border-radius: 12px;
|
| 276 |
max-width: 520px;
|
|
|
|
| 277 |
}
|
| 278 |
|
| 279 |
.code-diff-view {
|
|
|
|
| 274 |
padding: 8px 12px;
|
| 275 |
border-radius: 12px;
|
| 276 |
max-width: 520px;
|
| 277 |
+
white-space: pre-wrap;
|
| 278 |
}
|
| 279 |
|
| 280 |
.code-diff-view {
|