Claude commited on
Commit
261664d
·
unverified ·
1 Parent(s): 580b270

wip: implement SPEC-22 progress bar removal (pending user decision)

Browse files

SPEC-22 Analysis Complete:
- gr.Progress() causes visual glitches with ChatInterface (confirmed by Gradio docs)
- Removed progress parameter and all progress() calls from research_agent
- Status feedback preserved via emoji-based AgentEvent.to_markdown() in stream

Options presented to user:
A. SPEC-22 (this commit) - Remove gr.Progress, use emoji status
B. Slider hack - Add gr.Slider as progress bar workaround
C. Full gr.Blocks refactor - Complete control but more work

Awaiting user decision on preferred approach.

Files changed (1) hide show
  1. src/app.py +2 -17
src/app.py CHANGED
@@ -129,7 +129,6 @@ async def research_agent(
129
  domain: str = "sexual_health",
130
  api_key: str = "",
131
  api_key_state: str = "",
132
- progress: gr.Progress = gr.Progress(), # noqa: B008
133
  ) -> AsyncGenerator[str, None]:
134
  """
135
  Gradio chat function that runs the research agent.
@@ -143,7 +142,6 @@ async def research_agent(
143
  domain: Research domain
144
  api_key: Optional user-provided API key (BYOK - auto-detects provider)
145
  api_key_state: Persistent API key state (survives example clicks)
146
- progress: Gradio progress tracker
147
 
148
  Yields:
149
  Markdown-formatted responses for streaming
@@ -187,21 +185,8 @@ async def research_agent(
187
  )
188
 
189
  async for event in orchestrator.run(message):
190
- # Update progress bar
191
- if event.type == "started":
192
- progress(0, desc="Starting research...")
193
- elif event.type == "thinking":
194
- progress(0.1, desc="Multi-agent reasoning...")
195
- elif event.type == "progress":
196
- # Calculate progress percentage (fallback to 0.15 for events without iteration)
197
- p = 0.15
198
- max_iters = getattr(orchestrator, "_max_rounds", None) or getattr(
199
- getattr(orchestrator, "config", None), "max_iterations", 10
200
- )
201
- if event.iteration:
202
- # Map 0..max to 0.2..0.9
203
- p = 0.2 + (0.7 * (min(event.iteration, max_iters) / max_iters))
204
- progress(p, desc=event.message)
205
 
206
  # BUG FIX: Handle streaming events separately to avoid token-by-token spam
207
  if event.type == "streaming":
 
129
  domain: str = "sexual_health",
130
  api_key: str = "",
131
  api_key_state: str = "",
 
132
  ) -> AsyncGenerator[str, None]:
133
  """
134
  Gradio chat function that runs the research agent.
 
142
  domain: Research domain
143
  api_key: Optional user-provided API key (BYOK - auto-detects provider)
144
  api_key_state: Persistent API key state (survives example clicks)
 
145
 
146
  Yields:
147
  Markdown-formatted responses for streaming
 
185
  )
186
 
187
  async for event in orchestrator.run(message):
188
+ # SPEC-22: Progress bar removed - gr.Progress() causes visual glitches with ChatInterface
189
+ # Status feedback is provided via emoji-based AgentEvent.to_markdown() yielded in stream
 
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
  # BUG FIX: Handle streaming events separately to avoid token-by-token spam
192
  if event.type == "streaming":