Spaces:
Running
Running
Deploy c21a7f4a
Browse files- .freebuff/project-id +1 -0
- .freebuff/run.md +39 -0
- .opencodereview/vectors/chroma.sqlite3 +1 -1
- app.py +46 -4
.freebuff/project-id
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
8e60dca3-ae82-4192-8f49-6761ef4f1f6c
|
.freebuff/run.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OpenCodeReview β run notes (Gradio web UI)
|
| 2 |
+
|
| 3 |
+
## Reproduce the artifacts
|
| 4 |
+
|
| 5 |
+
1. Use the system Python 3.12 (the checked-in `.venv` is a partial install
|
| 6 |
+
without gradio): `C:\Program Files\Python312\python.exe` β available as
|
| 7 |
+
`python` on PATH. The full dependency set (gradio 6.19, langgraph,
|
| 8 |
+
langchain*, chromadb, langfuse, β¦) is already installed there for the
|
| 9 |
+
user profile.
|
| 10 |
+
2. No `.env` copying is required: `.env` already exists in this checkout and
|
| 11 |
+
the app does not load it automatically. Note the shell exports
|
| 12 |
+
`PORT=0` globally on this machine; the app now ignores invalid values
|
| 13 |
+
(`_resolve_port()` in `app.py`) and falls back to 7860.
|
| 14 |
+
3. No LLM keys are set, so reviews run in degraded mode (reviewer nodes log
|
| 15 |
+
"LLM unavailable β skipping"); the pipeline still completes and the UI
|
| 16 |
+
renders verdict/findings from the aggregator's rule-based path. The
|
| 17 |
+
Smoke Test tab works fully without keys.
|
| 18 |
+
|
| 19 |
+
## Run the server
|
| 20 |
+
|
| 21 |
+
```bash
|
| 22 |
+
python app.py # from the repo root; binds 0.0.0.0:7860
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
- Default port **7860** (override with `PORT`, values <1 or >65535 fall
|
| 26 |
+
back to 7860).
|
| 27 |
+
- Gradio prints `Running on local URL: http://0.0.0.0:7860`; open
|
| 28 |
+
<http://127.0.0.1:7860/>.
|
| 29 |
+
- Logs go to stdout (or redirect to a file when launched detached).
|
| 30 |
+
- Stop: `taskkill //PID <pid> //F` (Windows) or close the process.
|
| 31 |
+
|
| 32 |
+
## Detached launch (Windows, PowerShell)
|
| 33 |
+
|
| 34 |
+
```powershell
|
| 35 |
+
powershell -NoProfile -Command "(Start-Process -FilePath 'python' -ArgumentList 'app.py' -RedirectStandardOutput '<log>' -RedirectStandardError '<log>.err' -WindowStyle Hidden -PassThru).Id"
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
Then confirm: `powershell -NoProfile -Command "Get-Process -Id <pid>"` and
|
| 39 |
+
`curl http://127.0.0.1:7860/`.
|
.opencodereview/vectors/chroma.sqlite3
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 9547776
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:585581c6d5a4b8405866d9022875b3100fd39a2e4501fb9d32566b786bf3ead1
|
| 3 |
size 9547776
|
app.py
CHANGED
|
@@ -78,6 +78,11 @@ RECOMMENDATION_ICONS = {
|
|
| 78 |
"comment": "π¬",
|
| 79 |
}
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
# βββ Orchestration βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 83 |
|
|
@@ -769,6 +774,11 @@ def run_review(repo: str, pr_number: int, endpoint_name: str = "", progress=gr.P
|
|
| 769 |
yield [None, None, None, None, None, None], "β Enter a repo in `owner/name` format."
|
| 770 |
return
|
| 771 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 772 |
# Fail fast on an unknown endpoint name (allow_custom_value lets any
|
| 773 |
# string through the dropdown; the reviewer nodes would otherwise
|
| 774 |
# swallow the ValueError and report a confusing empty review).
|
|
@@ -1040,6 +1050,18 @@ body.dark {
|
|
| 1040 |
border-color: var(--glass-edge) !important;
|
| 1041 |
backdrop-filter: blur(8px);
|
| 1042 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1043 |
body.dark .gradio-container {
|
| 1044 |
background: var(--bg-page) !important;
|
| 1045 |
}
|
|
@@ -1063,6 +1085,13 @@ body.dark input, body.dark textarea, body.dark select {
|
|
| 1063 |
border-color: var(--glass-edge) !important;
|
| 1064 |
backdrop-filter: blur(8px);
|
| 1065 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1066 |
body.dark label { color: var(--text-secondary) !important; }
|
| 1067 |
/* Field labels render as small pills in the Soft theme β restyle them
|
| 1068 |
as quiet glass chips instead of the default saturated background. */
|
|
@@ -1296,12 +1325,14 @@ with gr.Blocks(title="OpenCodeReview") as demo:
|
|
| 1296 |
|
| 1297 |
with gr.Row():
|
| 1298 |
endpoint_input = gr.Dropdown(
|
| 1299 |
-
choices
|
| 1300 |
-
|
|
|
|
|
|
|
| 1301 |
label="LLM Endpoint",
|
| 1302 |
info=(
|
| 1303 |
"Built-ins: Gemini and Groq (Groq serves Llama models). "
|
| 1304 |
-
"
|
| 1305 |
),
|
| 1306 |
# Grouped optgroup choices make Gradio's strict membership
|
| 1307 |
# check reject values that sit inside a group (e.g. a custom
|
|
@@ -1310,12 +1341,16 @@ with gr.Blocks(title="OpenCodeReview") as demo:
|
|
| 1310 |
# still fail with a clear error at review time.
|
| 1311 |
allow_custom_value=True,
|
| 1312 |
scale=3,
|
|
|
|
| 1313 |
)
|
| 1314 |
test_selected_btn = gr.Button("Test selected", size="sm", scale=1)
|
| 1315 |
endpoint_test_msg = gr.Markdown()
|
| 1316 |
|
| 1317 |
def on_test_selected(endpoint_name):
|
| 1318 |
"""Probe the currently selected endpoint (built-in or custom)."""
|
|
|
|
|
|
|
|
|
|
| 1319 |
if not endpoint_name:
|
| 1320 |
return (
|
| 1321 |
"βΉοΈ Leave the endpoint empty for auto (Gemini β Groq fallback), "
|
|
@@ -1356,6 +1391,7 @@ with gr.Blocks(title="OpenCodeReview") as demo:
|
|
| 1356 |
label="Type",
|
| 1357 |
info="openai = any OpenAI-compatible API (DeepSeek, OpenRouter, Ollamaβ¦)",
|
| 1358 |
scale=1,
|
|
|
|
| 1359 |
)
|
| 1360 |
with gr.Row():
|
| 1361 |
ep_base_url_input = gr.Textbox(
|
|
@@ -1407,6 +1443,12 @@ with gr.Blocks(title="OpenCodeReview") as demo:
|
|
| 1407 |
# ββ Event wiring ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 1408 |
def on_run_click(*args):
|
| 1409 |
"""Generator that clears old state, runs review, shows results."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1410 |
# Yield initial loading state β must match the 12 outputs of
|
| 1411 |
# run_btn.click in order (loading_box, cancel_btn, run_btn,
|
| 1412 |
# status_msg, 5 result displays, pr_state, results_panel,
|
|
@@ -1562,7 +1604,7 @@ with gr.Blocks(title="OpenCodeReview") as demo:
|
|
| 1562 |
"""Remove all UI-added endpoints and reset the dropdown."""
|
| 1563 |
clear_session_endpoints()
|
| 1564 |
return (
|
| 1565 |
-
gr.update(choices=dropdown_choices(), value=
|
| 1566 |
"π Cleared β dropdown reset to the built-in default.",
|
| 1567 |
_format_session_endpoints(),
|
| 1568 |
)
|
|
|
|
| 78 |
"comment": "π¬",
|
| 79 |
}
|
| 80 |
|
| 81 |
+
# Default dropdown choice shown in the UI. Gradio 6's Dropdown has no
|
| 82 |
+
# placeholder support, so a real choice is displayed and mapped back to
|
| 83 |
+
# the "" (auto) sentinel wherever the value enters the pipeline.
|
| 84 |
+
AUTO_ENDPOINT_CHOICE = "Auto (Gemini β Groq fallback)"
|
| 85 |
+
|
| 86 |
|
| 87 |
# βββ Orchestration βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 88 |
|
|
|
|
| 774 |
yield [None, None, None, None, None, None], "β Enter a repo in `owner/name` format."
|
| 775 |
return
|
| 776 |
|
| 777 |
+
# The UI may pass the display default; map it to the "" auto sentinel
|
| 778 |
+
# before any endpoint lookup (get_endpoint would raise on the label).
|
| 779 |
+
if endpoint_name == AUTO_ENDPOINT_CHOICE:
|
| 780 |
+
endpoint_name = ""
|
| 781 |
+
|
| 782 |
# Fail fast on an unknown endpoint name (allow_custom_value lets any
|
| 783 |
# string through the dropdown; the reviewer nodes would otherwise
|
| 784 |
# swallow the ValueError and report a confusing empty review).
|
|
|
|
| 1050 |
border-color: var(--glass-edge) !important;
|
| 1051 |
backdrop-filter: blur(8px);
|
| 1052 |
}
|
| 1053 |
+
/* Dropdowns are not native <select>: the visible box is the theme's
|
| 1054 |
+
div.wrap (opaque --input-background-fill) holding a borderless input.
|
| 1055 |
+
Painting only input/textarea/select filled just the inner input and
|
| 1056 |
+
left the wrap dark β the "lighter rectangle inside a darker box" bug.
|
| 1057 |
+
Tag dropdowns with the "glass-dropdown" elem class and paint their
|
| 1058 |
+
wrap so they read as one uniform glass field, visually identical to
|
| 1059 |
+
the Repository / PR # textboxes. */
|
| 1060 |
+
.gradio-container .glass-dropdown .wrap {
|
| 1061 |
+
background-color: var(--glass-field) !important;
|
| 1062 |
+
border-color: var(--glass-edge) !important;
|
| 1063 |
+
backdrop-filter: blur(8px);
|
| 1064 |
+
}
|
| 1065 |
body.dark .gradio-container {
|
| 1066 |
background: var(--bg-page) !important;
|
| 1067 |
}
|
|
|
|
| 1085 |
border-color: var(--glass-edge) !important;
|
| 1086 |
backdrop-filter: blur(8px);
|
| 1087 |
}
|
| 1088 |
+
/* Same wrap-fill fix for dark mode (see light-mode rule above). */
|
| 1089 |
+
body.dark .gradio-container .glass-dropdown .wrap {
|
| 1090 |
+
background-color: var(--glass-field) !important;
|
| 1091 |
+
color: var(--text-primary) !important;
|
| 1092 |
+
border-color: var(--glass-edge) !important;
|
| 1093 |
+
backdrop-filter: blur(8px);
|
| 1094 |
+
}
|
| 1095 |
body.dark label { color: var(--text-secondary) !important; }
|
| 1096 |
/* Field labels render as small pills in the Soft theme β restyle them
|
| 1097 |
as quiet glass chips instead of the default saturated background. */
|
|
|
|
| 1325 |
|
| 1326 |
with gr.Row():
|
| 1327 |
endpoint_input = gr.Dropdown(
|
| 1328 |
+
# The "" sentinel stays first in the choices so the
|
| 1329 |
+
# AUTO_ENDPOINT_CHOICE default is always a valid member.
|
| 1330 |
+
choices=[""] + dropdown_choices(),
|
| 1331 |
+
value=AUTO_ENDPOINT_CHOICE,
|
| 1332 |
label="LLM Endpoint",
|
| 1333 |
info=(
|
| 1334 |
"Built-ins: Gemini and Groq (Groq serves Llama models). "
|
| 1335 |
+
f"Default '{AUTO_ENDPOINT_CHOICE}' = Gemini β Groq fallback."
|
| 1336 |
),
|
| 1337 |
# Grouped optgroup choices make Gradio's strict membership
|
| 1338 |
# check reject values that sit inside a group (e.g. a custom
|
|
|
|
| 1341 |
# still fail with a clear error at review time.
|
| 1342 |
allow_custom_value=True,
|
| 1343 |
scale=3,
|
| 1344 |
+
elem_classes=["glass-dropdown"],
|
| 1345 |
)
|
| 1346 |
test_selected_btn = gr.Button("Test selected", size="sm", scale=1)
|
| 1347 |
endpoint_test_msg = gr.Markdown()
|
| 1348 |
|
| 1349 |
def on_test_selected(endpoint_name):
|
| 1350 |
"""Probe the currently selected endpoint (built-in or custom)."""
|
| 1351 |
+
# Map the display default back to the "" (auto) sentinel.
|
| 1352 |
+
if endpoint_name == AUTO_ENDPOINT_CHOICE:
|
| 1353 |
+
endpoint_name = ""
|
| 1354 |
if not endpoint_name:
|
| 1355 |
return (
|
| 1356 |
"βΉοΈ Leave the endpoint empty for auto (Gemini β Groq fallback), "
|
|
|
|
| 1391 |
label="Type",
|
| 1392 |
info="openai = any OpenAI-compatible API (DeepSeek, OpenRouter, Ollamaβ¦)",
|
| 1393 |
scale=1,
|
| 1394 |
+
elem_classes=["glass-dropdown"],
|
| 1395 |
)
|
| 1396 |
with gr.Row():
|
| 1397 |
ep_base_url_input = gr.Textbox(
|
|
|
|
| 1443 |
# ββ Event wiring ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 1444 |
def on_run_click(*args):
|
| 1445 |
"""Generator that clears old state, runs review, shows results."""
|
| 1446 |
+
# Map the dropdown's display default back to the "" (auto)
|
| 1447 |
+
# sentinel expected by the pipeline (endpoint == "" β built-in
|
| 1448 |
+
# with Gemini β Groq fallback).
|
| 1449 |
+
args = tuple(
|
| 1450 |
+
"" if a == AUTO_ENDPOINT_CHOICE else a for a in args
|
| 1451 |
+
)
|
| 1452 |
# Yield initial loading state β must match the 12 outputs of
|
| 1453 |
# run_btn.click in order (loading_box, cancel_btn, run_btn,
|
| 1454 |
# status_msg, 5 result displays, pr_state, results_panel,
|
|
|
|
| 1604 |
"""Remove all UI-added endpoints and reset the dropdown."""
|
| 1605 |
clear_session_endpoints()
|
| 1606 |
return (
|
| 1607 |
+
gr.update(choices=[""] + dropdown_choices(), value=AUTO_ENDPOINT_CHOICE),
|
| 1608 |
"π Cleared β dropdown reset to the built-in default.",
|
| 1609 |
_format_session_endpoints(),
|
| 1610 |
)
|