Commit
Β·
f206f49
1
Parent(s):
26fdadb
docs(SPEC-23): Complete Gradio 6.0.1 modernization audit
Browse filesSPEC-23 is now fully implemented:
- show_progress="full" β
- fill_height=True β
- autoscroll=True β
- Messages format β
(default in 6.0.1 - no type= param needed)
Key finding: Gradio 6.0.1 uses OpenAI-style message format by
default. The `type="messages"` parameter referenced in some docs
does not exist in 6.0.1 - the legacy tuple format was removed.
Updated SPEC-23 documentation to reflect the actual implementation.
- docs/specs/SPEC-23-GRADIO-MODERNIZATION.md +24 -25
- src/app.py +2 -1
docs/specs/SPEC-23-GRADIO-MODERNIZATION.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
# SPEC-23: Gradio 6.0 Modernization Audit
|
| 2 |
|
| 3 |
-
**Status:**
|
| 4 |
**Priority:** P3 (Technical alignment)
|
| 5 |
**Effort:** 30 minutes
|
| 6 |
**Dependencies:** SPEC-22 (Progress Bar Removal)
|
|
@@ -59,29 +59,28 @@ Only if we needed:
|
|
| 59 |
|
| 60 |
| Feature | Current | Best Practice | Action |
|
| 61 |
|---------|---------|---------------|--------|
|
| 62 |
-
|
|
| 63 |
-
| `fill_height` | Not set | `fill_height=True` | **
|
| 64 |
-
| `autoscroll` | Not set | `autoscroll=True` | **
|
| 65 |
-
| `show_progress` | Not set (minimal) | `show_progress="full"` | **
|
| 66 |
-
| `gr.Progress` | Used (broken) | Remove | **
|
| 67 |
|
| 68 |
---
|
| 69 |
|
| 70 |
## Detailed Findings
|
| 71 |
|
| 72 |
-
### 1. Message Format (
|
| 73 |
|
| 74 |
-
**
|
| 75 |
-
**Recommended:** `type="messages"`
|
| 76 |
|
| 77 |
-
|
| 78 |
```python
|
| 79 |
{"role": "user" | "assistant", "content": str}
|
| 80 |
```
|
| 81 |
|
| 82 |
This is the modern standard and aligns with our LLM backends.
|
| 83 |
|
| 84 |
-
**Note:**
|
| 85 |
|
| 86 |
### 2. Fill Height (`fill_height=True`)
|
| 87 |
|
|
@@ -104,14 +103,14 @@ Ensures chat auto-scrolls to the latest message during streaming. Critical for l
|
|
| 104 |
## Implementation Checklist
|
| 105 |
|
| 106 |
### SPEC-22 Items (Do First)
|
| 107 |
-
- [
|
| 108 |
-
- [
|
| 109 |
|
| 110 |
### SPEC-23 Items
|
| 111 |
-
- [
|
| 112 |
-
- [
|
| 113 |
-
- [
|
| 114 |
-
- [
|
| 115 |
|
| 116 |
---
|
| 117 |
|
|
@@ -131,7 +130,7 @@ demo = gr.ChatInterface(
|
|
| 131 |
)
|
| 132 |
```
|
| 133 |
|
| 134 |
-
### After (Modernized)
|
| 135 |
```python
|
| 136 |
demo = gr.ChatInterface(
|
| 137 |
fn=research_agent,
|
|
@@ -145,9 +144,9 @@ demo = gr.ChatInterface(
|
|
| 145 |
# SPEC-22: Use native progress instead of gr.Progress
|
| 146 |
show_progress="full",
|
| 147 |
# SPEC-23: Modern Gradio 6.0 settings
|
|
|
|
| 148 |
fill_height=True,
|
| 149 |
autoscroll=True,
|
| 150 |
-
# NOTE: type="messages" requires history format migration - evaluate separately
|
| 151 |
)
|
| 152 |
```
|
| 153 |
|
|
@@ -155,12 +154,12 @@ demo = gr.ChatInterface(
|
|
| 155 |
|
| 156 |
## Risk Assessment
|
| 157 |
|
| 158 |
-
| Change | Risk |
|
| 159 |
-
|
| 160 |
-
| `show_progress="full"` | Low |
|
| 161 |
-
| `fill_height=True` | Low |
|
| 162 |
-
| `autoscroll=True` | Low |
|
| 163 |
-
|
|
| 164 |
|
| 165 |
---
|
| 166 |
|
|
|
|
| 1 |
# SPEC-23: Gradio 6.0 Modernization Audit
|
| 2 |
|
| 3 |
+
**Status:** IMPLEMENTED
|
| 4 |
**Priority:** P3 (Technical alignment)
|
| 5 |
**Effort:** 30 minutes
|
| 6 |
**Dependencies:** SPEC-22 (Progress Bar Removal)
|
|
|
|
| 59 |
|
| 60 |
| Feature | Current | Best Practice | Action |
|
| 61 |
|---------|---------|---------------|--------|
|
| 62 |
+
| Message format | N/A | OpenAI-style dicts | β
**DEFAULT** - Gradio 6.0.1 uses messages format by default |
|
| 63 |
+
| `fill_height` | ~~Not set~~ | `fill_height=True` | β
**DONE** - Chat fills vertical space |
|
| 64 |
+
| `autoscroll` | ~~Not set~~ | `autoscroll=True` | β
**DONE** - Auto-scroll to latest message |
|
| 65 |
+
| `show_progress` | ~~Not set (minimal)~~ | `show_progress="full"` | β
**DONE** - Per SPEC-22 |
|
| 66 |
+
| `gr.Progress` | ~~Used (broken)~~ | Remove | β
**DONE** - Per SPEC-22 |
|
| 67 |
|
| 68 |
---
|
| 69 |
|
| 70 |
## Detailed Findings
|
| 71 |
|
| 72 |
+
### 1. Message Format (OpenAI-style)
|
| 73 |
|
| 74 |
+
**Status:** β
Default in Gradio 6.0.1
|
|
|
|
| 75 |
|
| 76 |
+
Gradio 6.0.1 uses OpenAI-style dictionaries by default:
|
| 77 |
```python
|
| 78 |
{"role": "user" | "assistant", "content": str}
|
| 79 |
```
|
| 80 |
|
| 81 |
This is the modern standard and aligns with our LLM backends.
|
| 82 |
|
| 83 |
+
**Note:** No `type=` parameter exists in Gradio 6.0.1 - the legacy tuple format was removed.
|
| 84 |
|
| 85 |
### 2. Fill Height (`fill_height=True`)
|
| 86 |
|
|
|
|
| 103 |
## Implementation Checklist
|
| 104 |
|
| 105 |
### SPEC-22 Items (Do First)
|
| 106 |
+
- [x] Remove `progress: gr.Progress = gr.Progress()` from `research_agent` signature
|
| 107 |
+
- [x] Remove all `progress(...)` calls in `research_agent`
|
| 108 |
|
| 109 |
### SPEC-23 Items
|
| 110 |
+
- [x] Add `show_progress="full"` to `gr.ChatInterface`
|
| 111 |
+
- [x] Add `fill_height=True` to `gr.ChatInterface`
|
| 112 |
+
- [x] Add `autoscroll=True` to `gr.ChatInterface`
|
| 113 |
+
- [x] Verify messages format is default (Gradio 6.0.1 - no `type=` param needed)
|
| 114 |
|
| 115 |
---
|
| 116 |
|
|
|
|
| 130 |
)
|
| 131 |
```
|
| 132 |
|
| 133 |
+
### After (Modernized) β
IMPLEMENTED
|
| 134 |
```python
|
| 135 |
demo = gr.ChatInterface(
|
| 136 |
fn=research_agent,
|
|
|
|
| 144 |
# SPEC-22: Use native progress instead of gr.Progress
|
| 145 |
show_progress="full",
|
| 146 |
# SPEC-23: Modern Gradio 6.0 settings
|
| 147 |
+
# NOTE: Gradio 6.0.1 uses messages format by default (no type= param needed)
|
| 148 |
fill_height=True,
|
| 149 |
autoscroll=True,
|
|
|
|
| 150 |
)
|
| 151 |
```
|
| 152 |
|
|
|
|
| 154 |
|
| 155 |
## Risk Assessment
|
| 156 |
|
| 157 |
+
| Change | Risk | Status |
|
| 158 |
+
|--------|------|--------|
|
| 159 |
+
| `show_progress="full"` | Low | β
Implemented |
|
| 160 |
+
| `fill_height=True` | Low | β
Implemented |
|
| 161 |
+
| `autoscroll=True` | Low | β
Implemented |
|
| 162 |
+
| Messages format | None | β
Default in Gradio 6.0.1 - no code change needed |
|
| 163 |
|
| 164 |
---
|
| 165 |
|
src/app.py
CHANGED
|
@@ -141,7 +141,7 @@ async def research_agent(
|
|
| 141 |
|
| 142 |
Args:
|
| 143 |
message: User's research question
|
| 144 |
-
history: Chat history (
|
| 145 |
domain: Research domain (None defaults to "sexual_health")
|
| 146 |
api_key: Optional user-provided API key (BYOK - auto-detects provider)
|
| 147 |
api_key_state: Persistent API key state (survives example clicks, can be None)
|
|
@@ -264,6 +264,7 @@ def create_demo() -> tuple[gr.ChatInterface, gr.Accordion]:
|
|
| 264 |
# SPEC-22: Use native progress instead of gr.Progress (which breaks ChatInterface)
|
| 265 |
show_progress="full",
|
| 266 |
# SPEC-23: Gradio 6.0 best practices
|
|
|
|
| 267 |
fill_height=True,
|
| 268 |
autoscroll=True,
|
| 269 |
examples=[
|
|
|
|
| 141 |
|
| 142 |
Args:
|
| 143 |
message: User's research question
|
| 144 |
+
history: Chat history (OpenAI-style: [{"role": "user"|"assistant", "content": str}])
|
| 145 |
domain: Research domain (None defaults to "sexual_health")
|
| 146 |
api_key: Optional user-provided API key (BYOK - auto-detects provider)
|
| 147 |
api_key_state: Persistent API key state (survives example clicks, can be None)
|
|
|
|
| 264 |
# SPEC-22: Use native progress instead of gr.Progress (which breaks ChatInterface)
|
| 265 |
show_progress="full",
|
| 266 |
# SPEC-23: Gradio 6.0 best practices
|
| 267 |
+
# NOTE: Gradio 6.0.1 uses messages format by default (no type= param needed)
|
| 268 |
fill_height=True,
|
| 269 |
autoscroll=True,
|
| 270 |
examples=[
|