Lzy01241010 Claude Opus 4.7 commited on
Commit
1856cd8
·
1 Parent(s): 154aaf2

ui: auto-clear question after run; add connection-error retry tip

Browse files

- After Run Research completes, the question textbox is cleared via .then() so the user can immediately ask a follow-up without pressing Clear.
- Added a small hint under the action row: if a connection error appears, wait a moment and retry.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -975,6 +975,7 @@ gradio-app > div {
975
 
976
  /* === Example buttons ==================================================== */
977
  .example-note { color: var(--q-muted); font-size: 13px; margin: 0 0 12px 0; line-height: 1.5; }
 
978
  .memory-help {
979
  color: var(--q-muted);
980
  font-size: 12.5px;
@@ -1931,6 +1932,11 @@ with gr.Blocks(
1931
  run_btn = gr.Button("Run Research", variant="primary", size="lg")
1932
  stop_btn = gr.Button("Stop", variant="stop", size="lg")
1933
  clear_btn = gr.Button("Clear", variant="secondary", size="lg")
 
 
 
 
 
1934
 
1935
  with gr.Group(elem_classes="section-card"):
1936
  gr.HTML(
@@ -2041,6 +2047,12 @@ with gr.Blocks(
2041
  fn=run_ui,
2042
  inputs=[question, max_turns, memory_strategy, temperature],
2043
  outputs=[answer, trace],
 
 
 
 
 
 
2044
  )
2045
  for btn, ex in zip(example_buttons, EXAMPLES):
2046
  btn.click(
 
975
 
976
  /* === Example buttons ==================================================== */
977
  .example-note { color: var(--q-muted); font-size: 13px; margin: 0 0 12px 0; line-height: 1.5; }
978
+ .connection-tip { color: var(--q-muted); font-size: 13px; margin: 12px 2px 0; line-height: 1.45; }
979
  .memory-help {
980
  color: var(--q-muted);
981
  font-size: 12.5px;
 
1932
  run_btn = gr.Button("Run Research", variant="primary", size="lg")
1933
  stop_btn = gr.Button("Stop", variant="stop", size="lg")
1934
  clear_btn = gr.Button("Clear", variant="secondary", size="lg")
1935
+ gr.HTML(
1936
+ '<div class="connection-tip">'
1937
+ 'If you see a connection error, please wait a moment and retry.'
1938
+ '</div>'
1939
+ )
1940
 
1941
  with gr.Group(elem_classes="section-card"):
1942
  gr.HTML(
 
2047
  fn=run_ui,
2048
  inputs=[question, max_turns, memory_strategy, temperature],
2049
  outputs=[answer, trace],
2050
+ ).then(
2051
+ # Auto-clear the question textbox once the run finishes so the user
2052
+ # can immediately ask a follow-up without manually pressing Clear.
2053
+ fn=lambda: "",
2054
+ inputs=[],
2055
+ outputs=[question],
2056
  )
2057
  for btn, ex in zip(example_buttons, EXAMPLES):
2058
  btn.click(