VibecoderMcSwaggins commited on
Commit
b16e7a5
Β·
1 Parent(s): 41f9a2b

docs: add UI/UX brainstorming for mode selection

Browse files

Documents current state after PR #58:
- Anthropic key only works for Simple mode (no AnthropicChatClient)
- Advanced mode requires OpenAI key (Magentic limitation)
- Screenshot analysis showing current UI issues
- Decision needed: remove Anthropic or keep?

docs/brainstorming/UI_MODE_SELECTION_UX.md ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # UI/UX Brainstorm: Mode Selection & API Key Experience
2
+
3
+ **Date**: 2025-11-28
4
+ **Status**: IMPLEMENTED (2025-11-28)
5
+ **Related**: Issues #52, #53, PR #58
6
+
7
+ ---
8
+
9
+ ## CRITICAL FINDING: Anthropic Key is Nearly Useless
10
+
11
+ **Code verification** (2025-11-28):
12
+ ```
13
+ grep -r "AnthropicChatClient" src/ β†’ NO RESULTS
14
+ grep -r "OpenAIChatClient" src/ β†’ 22 RESULTS (all Magentic agents)
15
+ ```
16
+
17
+ The `agent-framework` package (Microsoft's Magentic) **ONLY** has `OpenAIChatClient`.
18
+ There is no `AnthropicChatClient`. This means:
19
+
20
+ | Feature | OpenAI Key | Anthropic Key |
21
+ |---------|------------|---------------|
22
+ | Simple mode (Judge LLM) | βœ… GPT-5.1 | βœ… Claude Sonnet 4.5 |
23
+ | Advanced mode (Multi-agent) | βœ… Full orchestration | ❌ **DOES NOT WORK** |
24
+ | Value proposition | Full access | Simple mode only |
25
+
26
+ **Decision**: Keep Anthropic support for Simple mode, but ensure UX clearly differentiates capabilities.
27
+
28
+ ---
29
+
30
+ ## Current State (After PR #58)
31
+
32
+ ### What Users See (Screenshot 2025-11-28)
33
+
34
+ ```
35
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
36
+ β”‚ ≑ Examples β”‚
37
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
38
+ β”‚ β”‚ Orchestrator Mode β”‚
39
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
40
+ β”‚ What drugs improve female libido post-menopause? β”‚ simple β”‚
41
+ β”‚ Clinical trials for erectile dysfunction altern... β”‚ advanced β”‚
42
+ β”‚ Evidence for testosterone therapy in women with... β”‚ simple β”‚
43
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
44
+
45
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
46
+ β”‚ βš™οΈ Mode & API Key (Free tier works!) [β–Ό] β”‚
47
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
48
+ β”‚ β”‚
49
+ β”‚ Orchestrator Mode β”‚
50
+ β”‚ ⚑ Simple: Fast (Free/Any Key) | πŸ”¬ Advanced: Deep Multi-Agent (OpenAI Key Only) β”‚
51
+ β”‚ [● simple] [β—‹ advanced] β”‚
52
+ β”‚ β”‚
53
+ β”‚ πŸ”‘ API Key (Optional) β”‚
54
+ β”‚ Leave empty for free tier. Auto-detects provider from key prefix. β”‚
55
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
56
+ β”‚ β”‚ sk-... (OpenAI) or sk-ant-... (Anthropic) β”‚ β”‚
57
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
58
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
59
+ ```
60
+
61
+ ### Observations from Screenshot
62
+
63
+ 1. **Examples table**: 2 columns (Query + Mode) - clean, one example now shows "advanced" βœ…
64
+ 2. **One example shows "advanced"**: Improves discoverability of Advanced mode βœ…
65
+ 3. **Accordion collapsed by default**: Still collapsed, but with more inviting label βœ…
66
+ 4. **Placeholder mentions Anthropic**: Correct, but now clearly tied to Simple mode only via info text βœ…
67
+ 5. **"Advanced: Requires OpenAI key"**: Now more prominent with emojis and clearer phrasing in info text βœ…
68
+
69
+ ### The Two Modes
70
+
71
+ | Mode | Backend | Capabilities | Requirements |
72
+ |------|---------|--------------|--------------|
73
+ | **Simple** | Linear orchestrator | Search β†’ Judge β†’ Report (single pass) | None (free tier) or any API key |
74
+ | **Advanced** | Magentic multi-agent | SearchAgent, JudgeAgent, HypothesisAgent, ReportAgent working together with iterative refinement | **OpenAI API key only** |
75
+
76
+ ---
77
+
78
+ ## Problems Identified (Addressed)
79
+
80
+ ### P1: Advanced Mode is Hidden β†’ ADDRESSED
81
+ - **Fix**: One example now shows "advanced" mode.
82
+ - **Fix**: Accordion label is more descriptive.
83
+
84
+ ### P2: Mode/Key Relationship is Unclear β†’ ADDRESSED
85
+ - **Fix**: `gr.Radio` info text clearly states "OpenAI Key Only" for Advanced mode, using emojis for emphasis.
86
+
87
+ ### P3: No Incentive to Try Advanced β†’ PARTIALLY ADDRESSED
88
+ - **Fix**: Emojis and "Deep Multi-Agent" hint at the value. Further marketing/documentation still needed for full "wow" moment.
89
+
90
+ ### P4: Anthropic Users Left Out β†’ ADDRESSED (Clarified)
91
+ - **Fix**: Anthropic keys still work for Simple mode, and the info text clarifies the limitation for Advanced mode.
92
+
93
+ ---
94
+
95
+ ## Options to Consider (Decision Made)
96
+
97
+ The recommendation of **Modified Option A (Better Education + Examples)** with slight modification to accordion label was implemented.
98
+
99
+ ---
100
+
101
+ ## Implementation Notes (Completed)
102
+
103
+ ```python
104
+ # From src/app.py
105
+ examples=[
106
+ ["What drugs improve female libido post-menopause?", "simple"],
107
+ ["Clinical trials for erectile dysfunction alternatives to PDE5 inhibitors?", "advanced"], # Changed
108
+ ["Evidence for testosterone therapy in women with HSDD?", "simple"],
109
+ ],
110
+
111
+ additional_inputs_accordion=gr.Accordion(
112
+ label="βš™οΈ Mode & API Key (Free tier works!)", # Changed
113
+ open=False
114
+ ),
115
+
116
+ gr.Radio(
117
+ choices=["simple", "advanced"],
118
+ value="simple",
119
+ label="Orchestrator Mode",
120
+ info=( # Changed
121
+ "⚑ Simple: Fast (Free/Any Key) | "
122
+ "πŸ”¬ Advanced: Deep Multi-Agent (OpenAI Key Only)"
123
+ ),
124
+ ),
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Decision Log
130
+
131
+ | Date | Decision | Rationale |
132
+ |------|----------|-----------|
133
+ | 2025-11-28 | Implemented Modified Option A | Minimal changes, high impact on discoverability, graceful fallback, user-approved accordion label. |
src/app.py CHANGED
@@ -181,13 +181,16 @@ async def research_agent(
181
  yield f"❌ **Error**: {e!s}"
182
 
183
 
184
- def create_demo() -> gr.ChatInterface:
185
  """
186
  Create the Gradio demo interface with MCP support.
187
 
188
  Returns:
189
  Configured Gradio Blocks interface with MCP server enabled
190
  """
 
 
 
191
  # 1. Unwrapped ChatInterface (Fixes Accordion Bug)
192
  demo = gr.ChatInterface(
193
  fn=research_agent,
@@ -202,19 +205,29 @@ def create_demo() -> gr.ChatInterface:
202
  "**MCP Server Active**: Connect Claude Desktop to `/gradio_api/mcp/`"
203
  ),
204
  examples=[
205
- ["What drugs improve female libido post-menopause?", "simple"],
206
- ["Clinical trials for erectile dysfunction alternatives to PDE5 inhibitors?", "simple"],
207
- ["Evidence for testosterone therapy in women with HSDD?", "simple"],
 
 
 
 
 
 
 
 
 
208
  ],
209
- additional_inputs_accordion=gr.Accordion(
210
- label="βš™οΈ Settings (Free tier works without API key)", open=False
211
- ),
212
  additional_inputs=[
213
  gr.Radio(
214
  choices=["simple", "advanced"],
215
  value="simple",
216
  label="Orchestrator Mode",
217
- info=("Simple: Works with any key or free tier | " "Advanced: Requires OpenAI key"),
 
 
 
218
  ),
219
  gr.Textbox(
220
  label="πŸ”‘ API Key (Optional)",
@@ -225,12 +238,12 @@ def create_demo() -> gr.ChatInterface:
225
  ],
226
  )
227
 
228
- return demo
229
 
230
 
231
  def main() -> None:
232
  """Run the Gradio app with MCP server enabled."""
233
- demo = create_demo()
234
  demo.launch(
235
  server_name="0.0.0.0",
236
  server_port=7860,
 
181
  yield f"❌ **Error**: {e!s}"
182
 
183
 
184
+ def create_demo() -> tuple[gr.ChatInterface, gr.Accordion]:
185
  """
186
  Create the Gradio demo interface with MCP support.
187
 
188
  Returns:
189
  Configured Gradio Blocks interface with MCP server enabled
190
  """
191
+ additional_inputs_accordion = gr.Accordion(
192
+ label="βš™οΈ Mode & API Key (Free tier works!)", open=False
193
+ )
194
  # 1. Unwrapped ChatInterface (Fixes Accordion Bug)
195
  demo = gr.ChatInterface(
196
  fn=research_agent,
 
205
  "**MCP Server Active**: Connect Claude Desktop to `/gradio_api/mcp/`"
206
  ),
207
  examples=[
208
+ [
209
+ "What drugs improve female libido post-menopause?",
210
+ "simple",
211
+ ],
212
+ [
213
+ "Clinical trials for erectile dysfunction alternatives to PDE5 inhibitors?",
214
+ "advanced",
215
+ ],
216
+ [
217
+ "Evidence for testosterone therapy in women with HSDD?",
218
+ "simple",
219
+ ],
220
  ],
221
+ additional_inputs_accordion=additional_inputs_accordion,
 
 
222
  additional_inputs=[
223
  gr.Radio(
224
  choices=["simple", "advanced"],
225
  value="simple",
226
  label="Orchestrator Mode",
227
+ info=(
228
+ "⚑ Simple: Fast (Free/Any Key) | "
229
+ "πŸ”¬ Advanced: Deep Multi-Agent (OpenAI Key Only)"
230
+ ),
231
  ),
232
  gr.Textbox(
233
  label="πŸ”‘ API Key (Optional)",
 
238
  ],
239
  )
240
 
241
+ return demo, additional_inputs_accordion
242
 
243
 
244
  def main() -> None:
245
  """Run the Gradio app with MCP server enabled."""
246
+ demo, _ = create_demo()
247
  demo.launch(
248
  server_name="0.0.0.0",
249
  server_port=7860,
tests/unit/test_ui_elements.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from src.app import create_demo
4
+
5
+
6
+ def test_examples_include_advanced_mode():
7
+ """Verify that one example entry uses 'advanced' mode."""
8
+ demo, _ = create_demo()
9
+ assert any(
10
+ "advanced" == example[1] for example in demo.examples
11
+ ), "Expected at least one example to be 'advanced' mode"
12
+
13
+
14
+ def test_accordion_label_updated():
15
+ """Verify the accordion label reflects the new, concise text."""
16
+ _, accordion = create_demo()
17
+ assert (
18
+ accordion.label == "βš™οΈ Mode & API Key (Free tier works!)"
19
+ ), "Accordion label not updated to 'βš™οΈ Mode & API Key (Free tier works!)'"
20
+
21
+
22
+ def test_orchestrator_mode_info_text_updated():
23
+ """Verify the Orchestrator Mode info text contains the new emojis and phrasing."""
24
+ demo, _ = create_demo()
25
+ # Assuming additional_inputs is a list and the Radio is the first element
26
+ orchestrator_radio = demo.additional_inputs[0]
27
+ expected_info = (
28
+ "⚑ Simple: Fast (Free/Any Key) | " "πŸ”¬ Advanced: Deep Multi-Agent " "(OpenAI Key Only)"
29
+ )
30
+ assert isinstance(
31
+ orchestrator_radio, gr.Radio
32
+ ), "Expected first additional input to be gr.Radio"
33
+ assert (
34
+ orchestrator_radio.info == expected_info
35
+ ), "Orchestrator Mode info text not updated correctly"