Spaces:
Sleeping
Polish UI: labeled controls, depth, live solving feedback
Browse files- Fix the controls bar: container=False was silently discarding the
Model / Max retries / API key labels (Gradio ignores show_label in
that combo), leaving three unlabeled fields. Controls now render with
small-caps labels, with Gradio's inner block chrome stripped by CSS
so they still sit flat in the bar.
- Status bar now flips to a pulsing "Solving with <model>โฆ" pill the
moment Solve/Regenerate is clicked (chained .then() step), instead of
showing "Idle" until the run finishes.
- Visual depth pass: layered shadows on panels/bars, soft radial glow
behind the header, gradient app mark, chip badges (Lean 4 / Mathlib
RAG / LangGraph), focus-within elevation on panels, button focus
rings and press states, halo on panel-title dots.
- Detail work: thin warm scrollbars in code panes and logs, tabular
numerals on the slider, focus glow on inputs, rounded dropdown
popover with shadow, mobile stacking for the editor row,
color-scheme: light to keep HF dark mode from reintroducing
white-on-white.
- Removed the stale two-stage-retry comment block left from the
fast-model removal.
|
@@ -105,7 +105,7 @@ class _capture_stdout:
|
|
| 105 |
|
| 106 |
GROQ_MODELS = [
|
| 107 |
"openai/gpt-oss-120b", # default, strongest open-weight on Groq
|
| 108 |
-
"openai/gpt-oss-20b", # fast / cheap GPT-OSS
|
| 109 |
"qwen/qwen3-32b", # Qwen 3, 32B reasoning model
|
| 110 |
"meta-llama/llama-4-scout-17b-16e-instruct", # Llama 4 MoE
|
| 111 |
]
|
|
@@ -145,16 +145,22 @@ CUSTOM_CSS = """
|
|
| 145 |
--accent-soft: #FBE9DF;
|
| 146 |
--ok: #2E7D55;
|
| 147 |
--err: #B85450;
|
|
|
|
|
|
|
| 148 |
}
|
| 149 |
|
| 150 |
-
/* Container
|
| 151 |
.gradio-container {
|
| 152 |
-
background: var(--bg) !important;
|
|
|
|
|
|
|
|
|
|
| 153 |
color: var(--text) !important;
|
|
|
|
| 154 |
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
|
| 155 |
max-width: 1400px !important;
|
| 156 |
margin: 0 auto !important;
|
| 157 |
-
padding:
|
| 158 |
}
|
| 159 |
footer, .show-api { display: none !important; }
|
| 160 |
|
|
@@ -163,54 +169,89 @@ footer, .show-api { display: none !important; }
|
|
| 163 |
display: flex;
|
| 164 |
align-items: center;
|
| 165 |
justify-content: space-between;
|
| 166 |
-
|
|
|
|
|
|
|
| 167 |
padding: 0 4px;
|
| 168 |
}
|
| 169 |
#header .title {
|
| 170 |
-
font-size:
|
| 171 |
-
font-weight:
|
| 172 |
-
letter-spacing: -0.
|
| 173 |
color: var(--text);
|
| 174 |
display: flex;
|
| 175 |
align-items: center;
|
| 176 |
-
gap:
|
| 177 |
}
|
| 178 |
#header .title .mark {
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
color: var(--text-muted);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
}
|
| 186 |
|
| 187 |
-
/* โโโ
|
| 188 |
#controls {
|
| 189 |
display: flex;
|
| 190 |
-
align-items:
|
| 191 |
-
gap:
|
| 192 |
-
margin-bottom:
|
| 193 |
-
padding:
|
| 194 |
background: var(--panel);
|
| 195 |
border: 1px solid var(--border);
|
| 196 |
-
border-radius:
|
|
|
|
| 197 |
}
|
| 198 |
-
|
| 199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
color: var(--text-muted) !important;
|
| 201 |
-
|
| 202 |
-
margin: 0 6px 0 0 !important;
|
| 203 |
}
|
| 204 |
-
#controls .gradio-dropdown,
|
| 205 |
-
#controls .gradio-slider { margin: 0 !important; }
|
| 206 |
|
| 207 |
/* โโโ Editor panels โโโ */
|
| 208 |
.panel {
|
| 209 |
background: var(--panel);
|
| 210 |
border: 1px solid var(--border);
|
| 211 |
-
border-radius:
|
| 212 |
overflow: hidden;
|
| 213 |
-
box-shadow:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
}
|
| 215 |
.panel-header {
|
| 216 |
display: flex !important;
|
|
@@ -220,7 +261,7 @@ footer, .show-api { display: none !important; }
|
|
| 220 |
background: var(--panel-tint) !important;
|
| 221 |
border-bottom: 1px solid var(--border-soft) !important;
|
| 222 |
gap: 8px !important;
|
| 223 |
-
min-height:
|
| 224 |
}
|
| 225 |
.panel-title {
|
| 226 |
font-family: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, monospace;
|
|
@@ -237,6 +278,7 @@ footer, .show-api { display: none !important; }
|
|
| 237 |
height: 8px;
|
| 238 |
border-radius: 50%;
|
| 239 |
background: var(--accent);
|
|
|
|
| 240 |
display: inline-block;
|
| 241 |
}
|
| 242 |
.panel-header .panel-actions {
|
|
@@ -245,28 +287,34 @@ footer, .show-api { display: none !important; }
|
|
| 245 |
align-items: center;
|
| 246 |
}
|
| 247 |
|
| 248 |
-
/* โโโ Buttons
|
| 249 |
.btn button {
|
| 250 |
-
background:
|
| 251 |
color: var(--text) !important;
|
| 252 |
border: 1px solid var(--border) !important;
|
| 253 |
-
border-radius:
|
| 254 |
-
padding: 5px
|
| 255 |
font-size: 12px !important;
|
| 256 |
-
font-weight:
|
| 257 |
min-width: 0 !important;
|
| 258 |
-
box-shadow:
|
| 259 |
transition: all 0.15s ease !important;
|
| 260 |
cursor: pointer;
|
| 261 |
}
|
| 262 |
.btn button:hover {
|
| 263 |
background: var(--panel-tint) !important;
|
| 264 |
-
border-color:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
}
|
| 266 |
.btn-primary button {
|
| 267 |
background: var(--accent) !important;
|
| 268 |
color: white !important;
|
| 269 |
border: 1px solid var(--accent) !important;
|
|
|
|
| 270 |
}
|
| 271 |
.btn-primary button:hover {
|
| 272 |
background: var(--accent-hover) !important;
|
|
@@ -279,6 +327,8 @@ footer, .show-api { display: none !important; }
|
|
| 279 |
font-family: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, monospace !important;
|
| 280 |
font-size: 13px !important;
|
| 281 |
line-height: 1.7 !important;
|
|
|
|
|
|
|
| 282 |
}
|
| 283 |
.cm-content { color: var(--text) !important; padding: 12px 0 !important; }
|
| 284 |
.cm-gutters {
|
|
@@ -290,6 +340,26 @@ footer, .show-api { display: none !important; }
|
|
| 290 |
.cm-activeLineGutter { background: var(--panel-tint) !important; color: var(--text) !important; }
|
| 291 |
.cm-cursor { border-left-color: var(--accent) !important; }
|
| 292 |
.cm-selectionBackground { background: var(--accent-soft) !important; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
|
| 294 |
/* Remove the harsh default block borders Gradio puts around gr.Code */
|
| 295 |
.gr-block.gr-code, .gradio-code {
|
|
@@ -298,21 +368,26 @@ footer, .show-api { display: none !important; }
|
|
| 298 |
}
|
| 299 |
|
| 300 |
/* โโโ Spacing between the two panes โโโ */
|
| 301 |
-
#editor-row { gap:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 302 |
|
| 303 |
/* โโโ Logs accordion โโโ */
|
| 304 |
.gradio-accordion {
|
| 305 |
background: var(--panel) !important;
|
| 306 |
border: 1px solid var(--border) !important;
|
| 307 |
-
border-radius:
|
| 308 |
margin-top: 16px !important;
|
| 309 |
overflow: hidden;
|
|
|
|
| 310 |
}
|
| 311 |
.gradio-accordion > button {
|
| 312 |
background: var(--panel-tint) !important;
|
| 313 |
color: var(--text-muted) !important;
|
| 314 |
font-size: 12px !important;
|
| 315 |
-
font-weight:
|
| 316 |
padding: 10px 14px !important;
|
| 317 |
border: none !important;
|
| 318 |
text-align: left !important;
|
|
@@ -325,6 +400,8 @@ footer, .show-api { display: none !important; }
|
|
| 325 |
font-size: 12px !important;
|
| 326 |
padding: 12px 14px !important;
|
| 327 |
line-height: 1.6 !important;
|
|
|
|
|
|
|
| 328 |
}
|
| 329 |
|
| 330 |
/* โโโ Status bar โโโ */
|
|
@@ -333,39 +410,56 @@ footer, .show-api { display: none !important; }
|
|
| 333 |
align-items: center;
|
| 334 |
gap: 12px;
|
| 335 |
margin-top: 16px;
|
| 336 |
-
padding:
|
| 337 |
background: var(--panel);
|
| 338 |
border: 1px solid var(--border);
|
| 339 |
-
border-radius:
|
| 340 |
font-size: 13px;
|
| 341 |
color: var(--text);
|
|
|
|
| 342 |
}
|
| 343 |
#status-bar .pill {
|
| 344 |
display: inline-flex;
|
| 345 |
align-items: center;
|
| 346 |
-
|
|
|
|
| 347 |
font-size: 11px;
|
| 348 |
-
font-weight:
|
| 349 |
-
letter-spacing: 0.
|
| 350 |
text-transform: uppercase;
|
| 351 |
border-radius: 999px;
|
|
|
|
| 352 |
}
|
| 353 |
#status-bar .pill.ok { background: #E8F3EC; color: var(--ok); }
|
| 354 |
#status-bar .pill.err { background: #FBE9E7; color: var(--err); }
|
| 355 |
#status-bar .pill.idle { background: var(--panel-tint); color: var(--text-muted); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
|
| 357 |
-
/* โโโ Form chrome (dropdown, slider) โโโ */
|
| 358 |
.gradio-dropdown input,
|
| 359 |
.gradio-dropdown .wrap {
|
| 360 |
background: var(--panel) !important;
|
| 361 |
color: var(--text) !important;
|
| 362 |
border: 1px solid var(--border) !important;
|
| 363 |
-
border-radius:
|
| 364 |
font-size: 13px !important;
|
| 365 |
}
|
| 366 |
.gradio-dropdown input:focus,
|
| 367 |
.gradio-dropdown .wrap:focus-within {
|
| 368 |
border-color: var(--accent) !important;
|
|
|
|
| 369 |
outline: none !important;
|
| 370 |
}
|
| 371 |
input[type="range"] { accent-color: var(--accent) !important; }
|
|
@@ -373,45 +467,32 @@ input[type="range"] { accent-color: var(--accent) !important; }
|
|
| 373 |
color: var(--text) !important;
|
| 374 |
font-size: 13px !important;
|
| 375 |
background: var(--panel) !important;
|
|
|
|
| 376 |
}
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */
|
| 384 |
-
|
| 385 |
-
/* Force readable text everywhere in code editors, regardless of theme/state. */
|
| 386 |
-
.cm-editor,
|
| 387 |
-
.cm-editor .cm-content,
|
| 388 |
-
.cm-editor .cm-line,
|
| 389 |
-
.cm-editor .cm-line span,
|
| 390 |
-
.cm-editor .cm-content * {
|
| 391 |
-
color: #1A1A1A !important;
|
| 392 |
}
|
| 393 |
-
.cm-editor .cm-cursor { border-left-color: var(--accent) !important; }
|
| 394 |
-
.cm-editor .cm-selectionBackground { background: var(--accent-soft) !important; }
|
| 395 |
|
| 396 |
-
/*
|
| 397 |
-
textarea,
|
| 398 |
-
|
| 399 |
-
.gradio-accordion textarea,
|
| 400 |
-
input[type="text"],
|
| 401 |
-
input[type="password"] {
|
| 402 |
color: #1A1A1A !important;
|
| 403 |
background: var(--panel) !important;
|
| 404 |
}
|
| 405 |
::placeholder { color: var(--text-muted) !important; opacity: 1 !important; }
|
| 406 |
|
| 407 |
-
/*
|
| 408 |
-
white-on-white. Pin background to white, text to charcoal, and tint
|
| 409 |
-
the highlighted/selected row in Claude orange. */
|
| 410 |
ul[role="listbox"],
|
| 411 |
.gradio-dropdown ul,
|
| 412 |
.gradio-dropdown [role="listbox"] {
|
| 413 |
background: #FFFFFF !important;
|
| 414 |
border: 1px solid var(--border) !important;
|
|
|
|
|
|
|
| 415 |
color: #1A1A1A !important;
|
| 416 |
}
|
| 417 |
ul[role="listbox"] li,
|
|
@@ -419,6 +500,7 @@ ul[role="listbox"] li,
|
|
| 419 |
.gradio-dropdown [role="option"] {
|
| 420 |
color: #1A1A1A !important;
|
| 421 |
background: #FFFFFF !important;
|
|
|
|
| 422 |
}
|
| 423 |
ul[role="listbox"] li[aria-selected="true"],
|
| 424 |
ul[role="listbox"] li:hover,
|
|
@@ -427,28 +509,6 @@ ul[role="listbox"] li:hover,
|
|
| 427 |
background: var(--accent-soft) !important;
|
| 428 |
color: #1A1A1A !important;
|
| 429 |
}
|
| 430 |
-
|
| 431 |
-
/* Bound the editor panels so a long proof scrolls *inside* them
|
| 432 |
-
instead of stretching the page. ~520px is roughly 22 lines of code
|
| 433 |
-
at our font size + line-height, matching the gr.Code(lines=22) hint. */
|
| 434 |
-
.panel {
|
| 435 |
-
max-height: 580px;
|
| 436 |
-
}
|
| 437 |
-
.panel .cm-editor {
|
| 438 |
-
max-height: 520px;
|
| 439 |
-
overflow: auto;
|
| 440 |
-
}
|
| 441 |
-
.panel .cm-scroller {
|
| 442 |
-
max-height: 520px;
|
| 443 |
-
overflow: auto !important;
|
| 444 |
-
}
|
| 445 |
-
|
| 446 |
-
/* Bound the logs accordion (open state) so it doesn't push the
|
| 447 |
-
status bar off-screen for long log runs. */
|
| 448 |
-
.gradio-accordion textarea {
|
| 449 |
-
max-height: 240px;
|
| 450 |
-
overflow: auto !important;
|
| 451 |
-
}
|
| 452 |
"""
|
| 453 |
|
| 454 |
|
|
@@ -475,23 +535,17 @@ def solve_proof(lean_code: str, model_name: str, max_retries: int, anthropic_api
|
|
| 475 |
tmp.write(lean_code)
|
| 476 |
tmp.close()
|
| 477 |
|
| 478 |
-
# Two-stage retry: for Groq, try the cheap 8b on attempt 0 and
|
| 479 |
-
# escalate to the user's chosen model on retry. Skip for Claude
|
| 480 |
-
# (no clear cheap counterpart) and for users who explicitly picked 8b.
|
| 481 |
-
# Two-stage retry disabled โ every attempt uses the user-selected
|
| 482 |
-
# model so the proof generation behavior is predictable and matches
|
| 483 |
-
# what the dropdown shows.
|
| 484 |
-
fast_model = None
|
| 485 |
-
|
| 486 |
lean_env, retriever = _get_components()
|
| 487 |
|
| 488 |
log_buf = io.StringIO()
|
| 489 |
with _capture_stdout(log_buf):
|
|
|
|
|
|
|
| 490 |
agent = LangGraphAgent(
|
| 491 |
model_name=model_name,
|
| 492 |
max_retries=int(max_retries),
|
| 493 |
api_key=api_key,
|
| 494 |
-
fast_model=
|
| 495 |
lean_env=lean_env,
|
| 496 |
retriever=retriever,
|
| 497 |
)
|
|
@@ -523,7 +577,7 @@ def solve_proof(lean_code: str, model_name: str, max_retries: int, anthropic_api
|
|
| 523 |
|
| 524 |
|
| 525 |
def _status_html(kind: str, message: str) -> str:
|
| 526 |
-
label = {"ok": "Solved", "err": "Failed", "idle": "Idle"}.get(kind, kind)
|
| 527 |
return (
|
| 528 |
f'<div id="status-bar">'
|
| 529 |
f'<span class="pill {kind}">{label}</span>'
|
|
@@ -547,7 +601,11 @@ with gr.Blocks(
|
|
| 547 |
"""
|
| 548 |
<div id="header">
|
| 549 |
<div class="title"><span class="mark">โ</span> Lean 4 Proof Assistant</div>
|
| 550 |
-
<div class="
|
|
|
|
|
|
|
|
|
|
|
|
|
| 551 |
</div>
|
| 552 |
"""
|
| 553 |
)
|
|
@@ -556,18 +614,16 @@ with gr.Blocks(
|
|
| 556 |
with gr.Row(elem_id="controls"):
|
| 557 |
model_dropdown = gr.Dropdown(
|
| 558 |
choices=ALL_MODELS, value=GROQ_MODELS[0],
|
| 559 |
-
label="Model",
|
| 560 |
)
|
| 561 |
retries_slider = gr.Slider(
|
| 562 |
minimum=1, maximum=10, value=5, step=1,
|
| 563 |
-
label="Max retries",
|
| 564 |
)
|
| 565 |
anthropic_key_input = gr.Textbox(
|
| 566 |
-
label="Anthropic API key (
|
| 567 |
placeholder="sk-ant-โฆ",
|
| 568 |
type="password",
|
| 569 |
-
show_label=True,
|
| 570 |
-
container=False,
|
| 571 |
scale=2,
|
| 572 |
)
|
| 573 |
|
|
@@ -619,6 +675,9 @@ with gr.Blocks(
|
|
| 619 |
def _end_run():
|
| 620 |
return False
|
| 621 |
|
|
|
|
|
|
|
|
|
|
| 622 |
def _warn_on_model_change(running: bool):
|
| 623 |
if running:
|
| 624 |
gr.Warning(
|
|
@@ -631,12 +690,16 @@ with gr.Blocks(
|
|
| 631 |
|
| 632 |
# โโโ Wiring โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 633 |
solve_btn.click(_start_run, outputs=running_state).then(
|
|
|
|
|
|
|
| 634 |
solve_proof,
|
| 635 |
inputs=[lean_input, model_dropdown, retries_slider, anthropic_key_input],
|
| 636 |
outputs=[status_output, code_output, logs_output],
|
| 637 |
).then(_end_run, outputs=running_state)
|
| 638 |
|
| 639 |
regen_btn.click(_start_run, outputs=running_state).then(
|
|
|
|
|
|
|
| 640 |
solve_proof,
|
| 641 |
inputs=[lean_input, model_dropdown, retries_slider, anthropic_key_input],
|
| 642 |
outputs=[status_output, code_output, logs_output],
|
|
|
|
| 105 |
|
| 106 |
GROQ_MODELS = [
|
| 107 |
"openai/gpt-oss-120b", # default, strongest open-weight on Groq
|
| 108 |
+
"openai/gpt-oss-20b", # fast / cheap GPT-OSS
|
| 109 |
"qwen/qwen3-32b", # Qwen 3, 32B reasoning model
|
| 110 |
"meta-llama/llama-4-scout-17b-16e-instruct", # Llama 4 MoE
|
| 111 |
]
|
|
|
|
| 145 |
--accent-soft: #FBE9DF;
|
| 146 |
--ok: #2E7D55;
|
| 147 |
--err: #B85450;
|
| 148 |
+
--shadow-sm: 0 1px 2px rgba(26,26,26,0.04), 0 2px 8px rgba(26,26,26,0.04);
|
| 149 |
+
--shadow-md: 0 2px 4px rgba(26,26,26,0.05), 0 8px 24px rgba(26,26,26,0.07);
|
| 150 |
}
|
| 151 |
|
| 152 |
+
/* โโโ Container โโโ */
|
| 153 |
.gradio-container {
|
| 154 |
+
background-color: var(--bg) !important;
|
| 155 |
+
/* soft warm glow behind the header, fading into the cream base */
|
| 156 |
+
background-image: radial-gradient(900px 360px at 50% -120px, #F8E8DD 0%, rgba(248,232,221,0) 70%) !important;
|
| 157 |
+
background-repeat: no-repeat !important;
|
| 158 |
color: var(--text) !important;
|
| 159 |
+
color-scheme: light;
|
| 160 |
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
|
| 161 |
max-width: 1400px !important;
|
| 162 |
margin: 0 auto !important;
|
| 163 |
+
padding: 36px 28px 28px !important;
|
| 164 |
}
|
| 165 |
footer, .show-api { display: none !important; }
|
| 166 |
|
|
|
|
| 169 |
display: flex;
|
| 170 |
align-items: center;
|
| 171 |
justify-content: space-between;
|
| 172 |
+
flex-wrap: wrap;
|
| 173 |
+
gap: 12px;
|
| 174 |
+
margin-bottom: 28px;
|
| 175 |
padding: 0 4px;
|
| 176 |
}
|
| 177 |
#header .title {
|
| 178 |
+
font-size: 22px;
|
| 179 |
+
font-weight: 650;
|
| 180 |
+
letter-spacing: -0.02em;
|
| 181 |
color: var(--text);
|
| 182 |
display: flex;
|
| 183 |
align-items: center;
|
| 184 |
+
gap: 11px;
|
| 185 |
}
|
| 186 |
#header .title .mark {
|
| 187 |
+
display: inline-flex;
|
| 188 |
+
align-items: center;
|
| 189 |
+
justify-content: center;
|
| 190 |
+
width: 34px;
|
| 191 |
+
height: 34px;
|
| 192 |
+
border-radius: 9px;
|
| 193 |
+
background: linear-gradient(135deg, var(--accent) 0%, #E8946F 100%);
|
| 194 |
+
color: #fff;
|
| 195 |
+
font-size: 16px;
|
| 196 |
+
box-shadow: 0 2px 6px rgba(217,119,87,0.35);
|
| 197 |
+
}
|
| 198 |
+
#header .chips { display: flex; gap: 6px; }
|
| 199 |
+
#header .chip {
|
| 200 |
+
font-size: 11px;
|
| 201 |
+
font-weight: 600;
|
| 202 |
+
letter-spacing: 0.02em;
|
| 203 |
color: var(--text-muted);
|
| 204 |
+
background: var(--panel);
|
| 205 |
+
border: 1px solid var(--border);
|
| 206 |
+
border-radius: 999px;
|
| 207 |
+
padding: 4px 11px;
|
| 208 |
}
|
| 209 |
|
| 210 |
+
/* โโโ Controls bar โโโ */
|
| 211 |
#controls {
|
| 212 |
display: flex;
|
| 213 |
+
align-items: flex-end;
|
| 214 |
+
gap: 20px;
|
| 215 |
+
margin-bottom: 18px;
|
| 216 |
+
padding: 14px 18px;
|
| 217 |
background: var(--panel);
|
| 218 |
border: 1px solid var(--border);
|
| 219 |
+
border-radius: 12px;
|
| 220 |
+
box-shadow: var(--shadow-sm);
|
| 221 |
}
|
| 222 |
+
/* strip Gradio's inner block chrome so controls sit flat in the bar */
|
| 223 |
+
#controls .block, #controls .form {
|
| 224 |
+
background: transparent !important;
|
| 225 |
+
border: none !important;
|
| 226 |
+
box-shadow: none !important;
|
| 227 |
+
padding: 0 !important;
|
| 228 |
+
margin: 0 !important;
|
| 229 |
+
}
|
| 230 |
+
/* component labels โ small caps over each field */
|
| 231 |
+
#controls span[data-testid="block-info"],
|
| 232 |
+
#controls label > span:first-child {
|
| 233 |
+
display: inline-block;
|
| 234 |
+
font-size: 11px !important;
|
| 235 |
+
font-weight: 600 !important;
|
| 236 |
+
text-transform: uppercase;
|
| 237 |
+
letter-spacing: 0.06em;
|
| 238 |
color: var(--text-muted) !important;
|
| 239 |
+
margin-bottom: 5px !important;
|
|
|
|
| 240 |
}
|
|
|
|
|
|
|
| 241 |
|
| 242 |
/* โโโ Editor panels โโโ */
|
| 243 |
.panel {
|
| 244 |
background: var(--panel);
|
| 245 |
border: 1px solid var(--border);
|
| 246 |
+
border-radius: 14px;
|
| 247 |
overflow: hidden;
|
| 248 |
+
box-shadow: var(--shadow-sm);
|
| 249 |
+
transition: box-shadow 0.2s ease, border-color 0.2s ease;
|
| 250 |
+
max-height: 580px;
|
| 251 |
+
}
|
| 252 |
+
.panel:focus-within {
|
| 253 |
+
box-shadow: var(--shadow-md);
|
| 254 |
+
border-color: #DCD8CC;
|
| 255 |
}
|
| 256 |
.panel-header {
|
| 257 |
display: flex !important;
|
|
|
|
| 261 |
background: var(--panel-tint) !important;
|
| 262 |
border-bottom: 1px solid var(--border-soft) !important;
|
| 263 |
gap: 8px !important;
|
| 264 |
+
min-height: 46px;
|
| 265 |
}
|
| 266 |
.panel-title {
|
| 267 |
font-family: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, monospace;
|
|
|
|
| 278 |
height: 8px;
|
| 279 |
border-radius: 50%;
|
| 280 |
background: var(--accent);
|
| 281 |
+
box-shadow: 0 0 0 3px var(--accent-soft);
|
| 282 |
display: inline-block;
|
| 283 |
}
|
| 284 |
.panel-header .panel-actions {
|
|
|
|
| 287 |
align-items: center;
|
| 288 |
}
|
| 289 |
|
| 290 |
+
/* โโโ Buttons โโโ */
|
| 291 |
.btn button {
|
| 292 |
+
background: var(--panel) !important;
|
| 293 |
color: var(--text) !important;
|
| 294 |
border: 1px solid var(--border) !important;
|
| 295 |
+
border-radius: 7px !important;
|
| 296 |
+
padding: 5px 13px !important;
|
| 297 |
font-size: 12px !important;
|
| 298 |
+
font-weight: 550 !important;
|
| 299 |
min-width: 0 !important;
|
| 300 |
+
box-shadow: 0 1px 2px rgba(26,26,26,0.04) !important;
|
| 301 |
transition: all 0.15s ease !important;
|
| 302 |
cursor: pointer;
|
| 303 |
}
|
| 304 |
.btn button:hover {
|
| 305 |
background: var(--panel-tint) !important;
|
| 306 |
+
border-color: #CFCBBE !important;
|
| 307 |
+
}
|
| 308 |
+
.btn button:active { transform: translateY(1px); }
|
| 309 |
+
.btn button:focus-visible {
|
| 310 |
+
outline: 2px solid var(--accent) !important;
|
| 311 |
+
outline-offset: 2px !important;
|
| 312 |
}
|
| 313 |
.btn-primary button {
|
| 314 |
background: var(--accent) !important;
|
| 315 |
color: white !important;
|
| 316 |
border: 1px solid var(--accent) !important;
|
| 317 |
+
box-shadow: 0 1px 3px rgba(217,119,87,0.4) !important;
|
| 318 |
}
|
| 319 |
.btn-primary button:hover {
|
| 320 |
background: var(--accent-hover) !important;
|
|
|
|
| 327 |
font-family: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, monospace !important;
|
| 328 |
font-size: 13px !important;
|
| 329 |
line-height: 1.7 !important;
|
| 330 |
+
max-height: 520px;
|
| 331 |
+
overflow: auto;
|
| 332 |
}
|
| 333 |
.cm-content { color: var(--text) !important; padding: 12px 0 !important; }
|
| 334 |
.cm-gutters {
|
|
|
|
| 340 |
.cm-activeLineGutter { background: var(--panel-tint) !important; color: var(--text) !important; }
|
| 341 |
.cm-cursor { border-left-color: var(--accent) !important; }
|
| 342 |
.cm-selectionBackground { background: var(--accent-soft) !important; }
|
| 343 |
+
.cm-scroller { max-height: 520px; overflow: auto !important; }
|
| 344 |
+
|
| 345 |
+
/* readable text in editors regardless of theme/state */
|
| 346 |
+
.cm-editor, .cm-editor .cm-content, .cm-editor .cm-line,
|
| 347 |
+
.cm-editor .cm-line span, .cm-editor .cm-content * {
|
| 348 |
+
color: #1A1A1A !important;
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
/* thin warm scrollbars in code panes + logs */
|
| 352 |
+
.cm-scroller::-webkit-scrollbar,
|
| 353 |
+
.gradio-accordion textarea::-webkit-scrollbar { width: 8px; height: 8px; }
|
| 354 |
+
.cm-scroller::-webkit-scrollbar-thumb,
|
| 355 |
+
.gradio-accordion textarea::-webkit-scrollbar-thumb {
|
| 356 |
+
background: #DDD9CD;
|
| 357 |
+
border-radius: 4px;
|
| 358 |
+
}
|
| 359 |
+
.cm-scroller::-webkit-scrollbar-thumb:hover,
|
| 360 |
+
.gradio-accordion textarea::-webkit-scrollbar-thumb:hover { background: #C9C5B8; }
|
| 361 |
+
.cm-scroller::-webkit-scrollbar-track,
|
| 362 |
+
.gradio-accordion textarea::-webkit-scrollbar-track { background: transparent; }
|
| 363 |
|
| 364 |
/* Remove the harsh default block borders Gradio puts around gr.Code */
|
| 365 |
.gr-block.gr-code, .gradio-code {
|
|
|
|
| 368 |
}
|
| 369 |
|
| 370 |
/* โโโ Spacing between the two panes โโโ */
|
| 371 |
+
#editor-row { gap: 18px !important; }
|
| 372 |
+
@media (max-width: 900px) {
|
| 373 |
+
#editor-row { flex-direction: column !important; }
|
| 374 |
+
#controls { flex-wrap: wrap; }
|
| 375 |
+
}
|
| 376 |
|
| 377 |
/* โโโ Logs accordion โโโ */
|
| 378 |
.gradio-accordion {
|
| 379 |
background: var(--panel) !important;
|
| 380 |
border: 1px solid var(--border) !important;
|
| 381 |
+
border-radius: 12px !important;
|
| 382 |
margin-top: 16px !important;
|
| 383 |
overflow: hidden;
|
| 384 |
+
box-shadow: var(--shadow-sm);
|
| 385 |
}
|
| 386 |
.gradio-accordion > button {
|
| 387 |
background: var(--panel-tint) !important;
|
| 388 |
color: var(--text-muted) !important;
|
| 389 |
font-size: 12px !important;
|
| 390 |
+
font-weight: 550 !important;
|
| 391 |
padding: 10px 14px !important;
|
| 392 |
border: none !important;
|
| 393 |
text-align: left !important;
|
|
|
|
| 400 |
font-size: 12px !important;
|
| 401 |
padding: 12px 14px !important;
|
| 402 |
line-height: 1.6 !important;
|
| 403 |
+
max-height: 240px;
|
| 404 |
+
overflow: auto !important;
|
| 405 |
}
|
| 406 |
|
| 407 |
/* โโโ Status bar โโโ */
|
|
|
|
| 410 |
align-items: center;
|
| 411 |
gap: 12px;
|
| 412 |
margin-top: 16px;
|
| 413 |
+
padding: 11px 16px;
|
| 414 |
background: var(--panel);
|
| 415 |
border: 1px solid var(--border);
|
| 416 |
+
border-radius: 12px;
|
| 417 |
font-size: 13px;
|
| 418 |
color: var(--text);
|
| 419 |
+
box-shadow: var(--shadow-sm);
|
| 420 |
}
|
| 421 |
#status-bar .pill {
|
| 422 |
display: inline-flex;
|
| 423 |
align-items: center;
|
| 424 |
+
gap: 6px;
|
| 425 |
+
padding: 3px 11px;
|
| 426 |
font-size: 11px;
|
| 427 |
+
font-weight: 650;
|
| 428 |
+
letter-spacing: 0.04em;
|
| 429 |
text-transform: uppercase;
|
| 430 |
border-radius: 999px;
|
| 431 |
+
white-space: nowrap;
|
| 432 |
}
|
| 433 |
#status-bar .pill.ok { background: #E8F3EC; color: var(--ok); }
|
| 434 |
#status-bar .pill.err { background: #FBE9E7; color: var(--err); }
|
| 435 |
#status-bar .pill.idle { background: var(--panel-tint); color: var(--text-muted); }
|
| 436 |
+
#status-bar .pill.run { background: var(--accent-soft); color: var(--accent-hover); }
|
| 437 |
+
#status-bar .pill.run::before {
|
| 438 |
+
content: "";
|
| 439 |
+
width: 6px;
|
| 440 |
+
height: 6px;
|
| 441 |
+
border-radius: 50%;
|
| 442 |
+
background: var(--accent);
|
| 443 |
+
animation: statpulse 1.2s ease-in-out infinite;
|
| 444 |
+
}
|
| 445 |
+
@keyframes statpulse {
|
| 446 |
+
0%, 100% { opacity: 0.35; transform: scale(0.8); }
|
| 447 |
+
50% { opacity: 1; transform: scale(1.15); }
|
| 448 |
+
}
|
| 449 |
|
| 450 |
+
/* โโโ Form chrome (dropdown, slider, key field) โโโ */
|
| 451 |
.gradio-dropdown input,
|
| 452 |
.gradio-dropdown .wrap {
|
| 453 |
background: var(--panel) !important;
|
| 454 |
color: var(--text) !important;
|
| 455 |
border: 1px solid var(--border) !important;
|
| 456 |
+
border-radius: 7px !important;
|
| 457 |
font-size: 13px !important;
|
| 458 |
}
|
| 459 |
.gradio-dropdown input:focus,
|
| 460 |
.gradio-dropdown .wrap:focus-within {
|
| 461 |
border-color: var(--accent) !important;
|
| 462 |
+
box-shadow: 0 0 0 3px var(--accent-soft) !important;
|
| 463 |
outline: none !important;
|
| 464 |
}
|
| 465 |
input[type="range"] { accent-color: var(--accent) !important; }
|
|
|
|
| 467 |
color: var(--text) !important;
|
| 468 |
font-size: 13px !important;
|
| 469 |
background: var(--panel) !important;
|
| 470 |
+
font-variant-numeric: tabular-nums;
|
| 471 |
}
|
| 472 |
+
input[type="password"], input[type="text"] {
|
| 473 |
+
border-radius: 7px !important;
|
| 474 |
+
}
|
| 475 |
+
input[type="password"]:focus, input[type="text"]:focus {
|
| 476 |
+
border-color: var(--accent) !important;
|
| 477 |
+
box-shadow: 0 0 0 3px var(--accent-soft) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 478 |
}
|
|
|
|
|
|
|
| 479 |
|
| 480 |
+
/* inputs / textareas โ never white on white */
|
| 481 |
+
textarea, .gradio-textbox textarea, .gradio-accordion textarea,
|
| 482 |
+
input[type="text"], input[type="password"] {
|
|
|
|
|
|
|
|
|
|
| 483 |
color: #1A1A1A !important;
|
| 484 |
background: var(--panel) !important;
|
| 485 |
}
|
| 486 |
::placeholder { color: var(--text-muted) !important; opacity: 1 !important; }
|
| 487 |
|
| 488 |
+
/* dropdown popover โ pinned light so options never go white-on-white */
|
|
|
|
|
|
|
| 489 |
ul[role="listbox"],
|
| 490 |
.gradio-dropdown ul,
|
| 491 |
.gradio-dropdown [role="listbox"] {
|
| 492 |
background: #FFFFFF !important;
|
| 493 |
border: 1px solid var(--border) !important;
|
| 494 |
+
border-radius: 9px !important;
|
| 495 |
+
box-shadow: var(--shadow-md) !important;
|
| 496 |
color: #1A1A1A !important;
|
| 497 |
}
|
| 498 |
ul[role="listbox"] li,
|
|
|
|
| 500 |
.gradio-dropdown [role="option"] {
|
| 501 |
color: #1A1A1A !important;
|
| 502 |
background: #FFFFFF !important;
|
| 503 |
+
font-size: 13px !important;
|
| 504 |
}
|
| 505 |
ul[role="listbox"] li[aria-selected="true"],
|
| 506 |
ul[role="listbox"] li:hover,
|
|
|
|
| 509 |
background: var(--accent-soft) !important;
|
| 510 |
color: #1A1A1A !important;
|
| 511 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 512 |
"""
|
| 513 |
|
| 514 |
|
|
|
|
| 535 |
tmp.write(lean_code)
|
| 536 |
tmp.close()
|
| 537 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 538 |
lean_env, retriever = _get_components()
|
| 539 |
|
| 540 |
log_buf = io.StringIO()
|
| 541 |
with _capture_stdout(log_buf):
|
| 542 |
+
# fast_model=None: two-stage retry is disabled so every attempt
|
| 543 |
+
# uses the user-selected model and behavior matches the dropdown.
|
| 544 |
agent = LangGraphAgent(
|
| 545 |
model_name=model_name,
|
| 546 |
max_retries=int(max_retries),
|
| 547 |
api_key=api_key,
|
| 548 |
+
fast_model=None,
|
| 549 |
lean_env=lean_env,
|
| 550 |
retriever=retriever,
|
| 551 |
)
|
|
|
|
| 577 |
|
| 578 |
|
| 579 |
def _status_html(kind: str, message: str) -> str:
|
| 580 |
+
label = {"ok": "Solved", "err": "Failed", "idle": "Idle", "run": "Solving"}.get(kind, kind)
|
| 581 |
return (
|
| 582 |
f'<div id="status-bar">'
|
| 583 |
f'<span class="pill {kind}">{label}</span>'
|
|
|
|
| 601 |
"""
|
| 602 |
<div id="header">
|
| 603 |
<div class="title"><span class="mark">โ</span> Lean 4 Proof Assistant</div>
|
| 604 |
+
<div class="chips">
|
| 605 |
+
<span class="chip">Lean 4</span>
|
| 606 |
+
<span class="chip">Mathlib RAG</span>
|
| 607 |
+
<span class="chip">LangGraph</span>
|
| 608 |
+
</div>
|
| 609 |
</div>
|
| 610 |
"""
|
| 611 |
)
|
|
|
|
| 614 |
with gr.Row(elem_id="controls"):
|
| 615 |
model_dropdown = gr.Dropdown(
|
| 616 |
choices=ALL_MODELS, value=GROQ_MODELS[0],
|
| 617 |
+
label="Model", scale=2,
|
| 618 |
)
|
| 619 |
retries_slider = gr.Slider(
|
| 620 |
minimum=1, maximum=10, value=5, step=1,
|
| 621 |
+
label="Max retries", scale=1,
|
| 622 |
)
|
| 623 |
anthropic_key_input = gr.Textbox(
|
| 624 |
+
label="Anthropic API key (Claude models only)",
|
| 625 |
placeholder="sk-ant-โฆ",
|
| 626 |
type="password",
|
|
|
|
|
|
|
| 627 |
scale=2,
|
| 628 |
)
|
| 629 |
|
|
|
|
| 675 |
def _end_run():
|
| 676 |
return False
|
| 677 |
|
| 678 |
+
def _show_running(model_name: str):
|
| 679 |
+
return _status_html("run", f"Solving with {model_name} โ this can take a minuteโฆ")
|
| 680 |
+
|
| 681 |
def _warn_on_model_change(running: bool):
|
| 682 |
if running:
|
| 683 |
gr.Warning(
|
|
|
|
| 690 |
|
| 691 |
# โโโ Wiring โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 692 |
solve_btn.click(_start_run, outputs=running_state).then(
|
| 693 |
+
_show_running, inputs=model_dropdown, outputs=status_output,
|
| 694 |
+
).then(
|
| 695 |
solve_proof,
|
| 696 |
inputs=[lean_input, model_dropdown, retries_slider, anthropic_key_input],
|
| 697 |
outputs=[status_output, code_output, logs_output],
|
| 698 |
).then(_end_run, outputs=running_state)
|
| 699 |
|
| 700 |
regen_btn.click(_start_run, outputs=running_state).then(
|
| 701 |
+
_show_running, inputs=model_dropdown, outputs=status_output,
|
| 702 |
+
).then(
|
| 703 |
solve_proof,
|
| 704 |
inputs=[lean_input, model_dropdown, retries_slider, anthropic_key_input],
|
| 705 |
outputs=[status_output, code_output, logs_output],
|