VibecoderMcSwaggins commited on
Commit
abb7e9b
Β·
1 Parent(s): 70cda69

docs: Add SPEC-23 Gradio 6.0 Modernization Audit

Browse files

Identifies missing Gradio 6.0 best practices:
- fill_height=True (chat fills vertical space)
- autoscroll=True (auto-scroll during streaming)
- type="messages" (OpenAI-style format - evaluate separately)
- show_progress="full" (per SPEC-22)

Async agent can implement after SPEC-22.

docs/specs/SPEC-23-GRADIO-MODERNIZATION.md ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPEC-23: Gradio 6.0 Modernization Audit
2
+
3
+ **Status:** READY FOR IMPLEMENTATION
4
+ **Priority:** P3 (Technical alignment)
5
+ **Effort:** 30 minutes
6
+ **Dependencies:** SPEC-22 (Progress Bar Removal)
7
+
8
+ ---
9
+
10
+ ## Executive Summary
11
+
12
+ Audit of `src/app.py` against Gradio 6.0.1 best practices. Identifies parameters we should add or update for full alignment with modern Gradio.
13
+
14
+ ---
15
+
16
+ ## Current State vs Best Practices
17
+
18
+ | Feature | Current | Best Practice | Action |
19
+ |---------|---------|---------------|--------|
20
+ | `type` param | Not set (legacy) | `type="messages"` | **ADD** - Uses OpenAI-style message format |
21
+ | `fill_height` | Not set | `fill_height=True` | **ADD** - Chat fills vertical space |
22
+ | `autoscroll` | Not set | `autoscroll=True` | **ADD** - Auto-scroll to latest message |
23
+ | `show_progress` | Not set (minimal) | `show_progress="full"` | **ADD** - Per SPEC-22 |
24
+ | `gr.Progress` | Used (broken) | Remove | **REMOVE** - Per SPEC-22 |
25
+
26
+ ---
27
+
28
+ ## Detailed Findings
29
+
30
+ ### 1. Message Format (`type="messages"`)
31
+
32
+ **Current:** Not specified (uses legacy tuple format)
33
+ **Recommended:** `type="messages"`
34
+
35
+ The `type="messages"` format uses OpenAI-style dictionaries:
36
+ ```python
37
+ {"role": "user" | "assistant", "content": str}
38
+ ```
39
+
40
+ This is the modern standard and aligns with our LLM backends.
41
+
42
+ **Note:** This may require updating how we handle `history` parameter.
43
+
44
+ ### 2. Fill Height (`fill_height=True`)
45
+
46
+ **Current:** Not set
47
+ **Recommended:** `fill_height=True`
48
+
49
+ Makes the chat interface fill available vertical space. Better UX on larger screens.
50
+
51
+ **Known Issue:** [GitHub #10407](https://github.com/gradio-app/gradio/issues/10407) - May conflict with `save_history=True`. We don't use `save_history`, so should be fine.
52
+
53
+ ### 3. Autoscroll (`autoscroll=True`)
54
+
55
+ **Current:** Not set
56
+ **Recommended:** `autoscroll=True`
57
+
58
+ Ensures chat auto-scrolls to the latest message during streaming. Critical for long research outputs.
59
+
60
+ ---
61
+
62
+ ## Implementation Checklist
63
+
64
+ ### SPEC-22 Items (Do First)
65
+ - [ ] Remove `progress: gr.Progress = gr.Progress()` from `research_agent` signature
66
+ - [ ] Remove all `progress(...)` calls in `research_agent`
67
+
68
+ ### SPEC-23 Items
69
+ - [ ] Add `show_progress="full"` to `gr.ChatInterface`
70
+ - [ ] Add `fill_height=True` to `gr.ChatInterface`
71
+ - [ ] Add `autoscroll=True` to `gr.ChatInterface`
72
+ - [ ] Evaluate `type="messages"` migration (may require history format changes)
73
+
74
+ ---
75
+
76
+ ## Code Changes
77
+
78
+ ### Before (Current)
79
+ ```python
80
+ demo = gr.ChatInterface(
81
+ fn=research_agent,
82
+ title="πŸ† DeepBoner",
83
+ description=description,
84
+ examples=[...],
85
+ cache_examples=False,
86
+ run_examples_on_click=False,
87
+ additional_inputs_accordion=additional_inputs_accordion,
88
+ additional_inputs=[...],
89
+ )
90
+ ```
91
+
92
+ ### After (Modernized)
93
+ ```python
94
+ demo = gr.ChatInterface(
95
+ fn=research_agent,
96
+ title="πŸ† DeepBoner",
97
+ description=description,
98
+ examples=[...],
99
+ cache_examples=False,
100
+ run_examples_on_click=False,
101
+ additional_inputs_accordion=additional_inputs_accordion,
102
+ additional_inputs=[...],
103
+ # SPEC-22: Use native progress instead of gr.Progress
104
+ show_progress="full",
105
+ # SPEC-23: Modern Gradio 6.0 settings
106
+ fill_height=True,
107
+ autoscroll=True,
108
+ # NOTE: type="messages" requires history format migration - evaluate separately
109
+ )
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Risk Assessment
115
+
116
+ | Change | Risk | Mitigation |
117
+ |--------|------|------------|
118
+ | `show_progress="full"` | Low | Native Gradio feature |
119
+ | `fill_height=True` | Low | May affect layout, test visually |
120
+ | `autoscroll=True` | Low | Native feature, improves UX |
121
+ | `type="messages"` | Medium | Requires history format changes - defer if needed |
122
+
123
+ ---
124
+
125
+ ## Verification
126
+
127
+ ```bash
128
+ # After changes
129
+ make check
130
+
131
+ # Manual test
132
+ uv run python src/app.py
133
+ # Verify:
134
+ # 1. Chat fills vertical space
135
+ # 2. Auto-scrolls during streaming
136
+ # 3. Spinner appears (not floating progress bar)
137
+ ```
138
+
139
+ ---
140
+
141
+ ## References
142
+
143
+ - [Gradio ChatInterface Docs](https://www.gradio.app/docs/gradio/chatinterface)
144
+ - [GitHub #10407: fill_height with save_history](https://github.com/gradio-app/gradio/issues/10407)
145
+ - [GitHub #11109: Autoscroll issue](https://github.com/gradio-app/gradio/issues/11109)