Enhanced UI progress callback to use Gradio's built-in progress tracking mechanism for better real-time updates during report generation
This commit is contained in:
parent
9cb9d48466
commit
bc66deb129
|
@ -1,7 +1,13 @@
|
||||||
# Current Focus: Project Directory Reorganization, Testing, and Embedding Usage
|
# Current Focus: UI Bug Fixes, Project Directory Reorganization, and Embedding Usage
|
||||||
|
|
||||||
## Active Work
|
## Active Work
|
||||||
|
|
||||||
|
### UI Bug Fixes
|
||||||
|
- ✅ Fixed AttributeError in report generation progress callback
|
||||||
|
- ✅ Updated UI progress callback to use direct value assignment instead of update method
|
||||||
|
- ✅ Enhanced progress callback to use Gradio's built-in progress tracking mechanism for better UI updates during async operations
|
||||||
|
- ✅ Committed changes with message "Fix AttributeError in report progress callback by using direct value assignment instead of update method"
|
||||||
|
|
||||||
### Project Directory Reorganization
|
### Project Directory Reorganization
|
||||||
- ✅ Reorganized project directory structure for better maintainability
|
- ✅ Reorganized project directory structure for better maintainability
|
||||||
- ✅ Moved utility scripts to the `utils/` directory
|
- ✅ Moved utility scripts to the `utils/` directory
|
||||||
|
|
|
@ -1,5 +1,32 @@
|
||||||
# Session Log
|
# Session Log
|
||||||
|
|
||||||
|
## Session: 2025-03-17
|
||||||
|
|
||||||
|
### Overview
|
||||||
|
Fixed bugs in the UI progress callback mechanism for report generation.
|
||||||
|
|
||||||
|
### Key Activities
|
||||||
|
1. Identified and fixed an AttributeError in the report generation progress callback:
|
||||||
|
- Diagnosed the issue: 'Textbox' object has no attribute 'update'
|
||||||
|
- Fixed by replacing `update(value=...)` method calls with direct value assignment (`component.value = ...`)
|
||||||
|
- Committed changes with message "Fix AttributeError in report progress callback by using direct value assignment instead of update method"
|
||||||
|
- Updated memory bank documentation with the fix details
|
||||||
|
|
||||||
|
2. Enhanced the progress indicator to ensure UI updates during async operations:
|
||||||
|
- Identified that the progress indicator wasn't updating in real-time despite fixing the AttributeError
|
||||||
|
- Implemented a solution using Gradio's built-in progress tracking mechanism
|
||||||
|
- Added `progress(current_progress, desc=status_message)` to leverage Gradio's internal update mechanisms
|
||||||
|
- Maintained direct value assignments to custom UI elements for redundancy
|
||||||
|
- Tested the solution to confirm progress indicators now update properly during report generation
|
||||||
|
|
||||||
|
### Insights
|
||||||
|
- Gradio Textbox and Slider components use direct value assignment for updates rather than an update method
|
||||||
|
- Asynchronous operations in Gradio require special handling to ensure UI elements update in real-time
|
||||||
|
- Using Gradio's built-in progress tracking mechanism is more effective than manual UI updates for async tasks
|
||||||
|
- The progress callback mechanism is critical for providing user feedback during long-running report generation tasks
|
||||||
|
- Proper error handling in UI callbacks is essential for a smooth user experience
|
||||||
|
|
||||||
|
|
||||||
## Session: 2025-02-27
|
## Session: 2025-02-27
|
||||||
|
|
||||||
### Overview
|
### Overview
|
||||||
|
|
|
@ -376,9 +376,15 @@ class GradioInterface:
|
||||||
# Create a wrapper function that updates the UI elements
|
# Create a wrapper function that updates the UI elements
|
||||||
def ui_progress_callback(current_progress, total_chunks, current_report):
|
def ui_progress_callback(current_progress, total_chunks, current_report):
|
||||||
status_message = progress_callback(current_progress, total_chunks, current_report)
|
status_message = progress_callback(current_progress, total_chunks, current_report)
|
||||||
# Update the UI elements directly - use value assignment instead of update method
|
|
||||||
|
# Use Gradio's built-in progress tracking mechanism
|
||||||
|
# This will properly update the UI during async operations
|
||||||
|
progress(current_progress, desc=status_message)
|
||||||
|
|
||||||
|
# Also update our custom UI elements
|
||||||
self.report_progress.value = status_message
|
self.report_progress.value = status_message
|
||||||
self.report_progress_bar.value = int(current_progress * 100)
|
self.report_progress_bar.value = int(current_progress * 100)
|
||||||
|
|
||||||
return status_message
|
return status_message
|
||||||
|
|
||||||
self.report_generator.set_progress_callback(ui_progress_callback)
|
self.report_generator.set_progress_callback(ui_progress_callback)
|
||||||
|
|
Loading…
Reference in New Issue