juliets Claude Opus 4.8 (1M context) commited on
Commit
93dd9e3
·
1 Parent(s): b49008f

Drive per-model prompt fields from the visible picker, not the hidden dropdown

Browse files

The system-prompt note and grey-out (and the model info panel) were wired to the
hidden config model dropdown, which now only updates programmatically when the Test
tab picker syncs to it, and a programmatic update does not re-fire its listeners. So
selecting a classifier on the Test tab left the Advanced tab showing the GPT-OSS
prompt as editable. Wire format_model_info and the prompt-scope handler to the
visible picker (model_quick_select) directly, which fires reliably on user choice.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files changed (2) hide show
  1. app.py +17 -0
  2. ui/tab_config.py +5 -0
app.py CHANGED
@@ -297,6 +297,8 @@ with gr.Blocks(title="Moderation Model Testing") as demo:
297
  top_p = config_components["top_p"]
298
  system_prompt_textbox = config_components["system_prompt_textbox"]
299
  response_format_textbox = config_components["response_format_textbox"]
 
 
300
 
301
  dataset_components = build_dataset_tab()
302
  example_dropdown = dataset_components["example_dropdown"]
@@ -374,6 +376,21 @@ with gr.Blocks(title="Moderation Model Testing") as demo:
374
  model_quick_select.change(lambda v: v, inputs=model_quick_select, outputs=model_dropdown)
375
  model_dropdown.change(lambda v: v, inputs=model_dropdown, outputs=model_quick_select)
376
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
  # --- Say which policy a run will use -------------------------------------------
378
  active_policy_display = testing_components["active_policy_display"]
379
 
 
297
  top_p = config_components["top_p"]
298
  system_prompt_textbox = config_components["system_prompt_textbox"]
299
  response_format_textbox = config_components["response_format_textbox"]
300
+ prompt_scope_note = config_components["prompt_scope_note"]
301
+ update_on_model_change = config_components["update_on_model_change"]
302
 
303
  dataset_components = build_dataset_tab()
304
  example_dropdown = dataset_components["example_dropdown"]
 
376
  model_quick_select.change(lambda v: v, inputs=model_quick_select, outputs=model_dropdown)
377
  model_dropdown.change(lambda v: v, inputs=model_dropdown, outputs=model_quick_select)
378
 
379
+ # The hidden config dropdown only updates programmatically, which does not re-fire
380
+ # its listeners, so the visible picker drives the per-model UI directly: the model
381
+ # info panel, and the Advanced-tab prompt fields (greyed out with a note for the
382
+ # classifier/decision models that ignore them).
383
+ model_quick_select.change(
384
+ format_model_info,
385
+ inputs=[model_quick_select, reasoning_effort],
386
+ outputs=model_info_display,
387
+ )
388
+ model_quick_select.change(
389
+ update_on_model_change,
390
+ inputs=[model_quick_select, reasoning_effort],
391
+ outputs=[reasoning_effort, system_prompt_textbox, response_format_textbox, prompt_scope_note],
392
+ )
393
+
394
  # --- Say which policy a run will use -------------------------------------------
395
  active_policy_display = testing_components["active_policy_display"]
396
 
ui/tab_config.py CHANGED
@@ -130,7 +130,12 @@ def build_config_tab() -> dict:
130
  "reasoning_effort": reasoning_effort,
131
  "system_prompt_textbox": system_prompt_textbox,
132
  "response_format_textbox": response_format_textbox,
 
133
  "max_tokens": max_tokens,
134
  "temperature": temperature,
 
 
 
 
135
  "top_p": top_p,
136
  }
 
130
  "reasoning_effort": reasoning_effort,
131
  "system_prompt_textbox": system_prompt_textbox,
132
  "response_format_textbox": response_format_textbox,
133
+ "prompt_scope_note": prompt_scope_note,
134
  "max_tokens": max_tokens,
135
  "temperature": temperature,
136
+ # Exposed so the real (visible) model picker on the Test tab can drive these
137
+ # fields: the hidden model_dropdown here only updates programmatically, which
138
+ # does not re-fire its own .change, so the Test picker must call this directly.
139
+ "update_on_model_change": update_on_model_change,
140
  "top_p": top_p,
141
  }