Sdm0 commited on
Commit
57fa990
·
verified ·
1 Parent(s): aaa5f46

Deploy da765456

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -589,6 +589,19 @@ def run_review(repo: str, pr_number: int, endpoint_name: str = "", progress=gr.P
589
  yield [None, None, None, None, None, None], "❌ Enter a repo in `owner/name` format."
590
  return
591
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
  _cleanup_db()
593
 
594
  progress(0.1, desc="Building graph…")
@@ -1004,6 +1017,12 @@ with gr.Blocks(title="OpenCodeReview") as demo:
1004
  "Built-in: Gemini & Grok. Pick one, or add your own below. "
1005
  "Empty = auto (Gemini → Grok fallback)."
1006
  ),
 
 
 
 
 
 
1007
  scale=3,
1008
  )
1009
 
 
589
  yield [None, None, None, None, None, None], "❌ Enter a repo in `owner/name` format."
590
  return
591
 
592
+ # Fail fast on an unknown endpoint name (allow_custom_value lets any
593
+ # string through the dropdown; the reviewer nodes would otherwise
594
+ # swallow the ValueError and report a confusing empty review).
595
+ if endpoint_name:
596
+ from endpoints import get_endpoint
597
+
598
+ if get_endpoint(endpoint_name) is None:
599
+ yield [None, None, None, None, None, None], (
600
+ f"❌ Endpoint '{endpoint_name}' not found — pick one from "
601
+ "the list or add it in the form above."
602
+ )
603
+ return
604
+
605
  _cleanup_db()
606
 
607
  progress(0.1, desc="Building graph…")
 
1017
  "Built-in: Gemini & Grok. Pick one, or add your own below. "
1018
  "Empty = auto (Gemini → Grok fallback)."
1019
  ),
1020
+ # Grouped optgroup choices make Gradio's strict membership
1021
+ # check reject values that sit inside a group (e.g. a custom
1022
+ # endpoint registered moments ago). allow_custom_value lets
1023
+ # any registered endpoint name pass through; unknown names
1024
+ # still fail with a clear error at review time.
1025
+ allow_custom_value=True,
1026
  scale=3,
1027
  )
1028