Spaces:
Running
Running
bound review model prompt size
Browse files
nodes/correctness_reviewer.py
CHANGED
|
@@ -23,7 +23,10 @@ PROMPT_FILE = Path(__file__).resolve().parent.parent / "prompts" / f"correctness
|
|
| 23 |
# Max characters of context to include in the prompt (soft limit)
|
| 24 |
MAX_CONTEXT_CHARS = 6_000
|
| 25 |
# Max changed-file content to include per file
|
| 26 |
-
MAX_FILE_CONTENT_CHARS =
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
|
| 29 |
# βββ Load prompt from file ββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
@@ -72,7 +75,10 @@ def _build_prompt(state: OpenCodeReviewState) -> str:
|
|
| 72 |
lines: list[str] = []
|
| 73 |
|
| 74 |
lines.append("## Diff\n```diff")
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
| 76 |
lines.append("```\n")
|
| 77 |
|
| 78 |
# Changed files with full content (truncated per file)
|
|
|
|
| 23 |
# Max characters of context to include in the prompt (soft limit)
|
| 24 |
MAX_CONTEXT_CHARS = 6_000
|
| 25 |
# Max changed-file content to include per file
|
| 26 |
+
MAX_FILE_CONTENT_CHARS = 1_200
|
| 27 |
+
# Keep model requests below free-provider token limits. Deterministic checks
|
| 28 |
+
# still inspect the complete diff from state.diff.
|
| 29 |
+
MAX_DIFF_CHARS = 14_000
|
| 30 |
|
| 31 |
|
| 32 |
# βββ Load prompt from file ββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 75 |
lines: list[str] = []
|
| 76 |
|
| 77 |
lines.append("## Diff\n```diff")
|
| 78 |
+
diff = state.diff or ""
|
| 79 |
+
if len(diff) > MAX_DIFF_CHARS:
|
| 80 |
+
diff = diff[:MAX_DIFF_CHARS] + "\n⦠(diff truncated for model context)"
|
| 81 |
+
lines.append(diff)
|
| 82 |
lines.append("```\n")
|
| 83 |
|
| 84 |
# Changed files with full content (truncated per file)
|