DART-LLM_Task_Decomposer / EDITING_WORKFLOW_GUIDE.md
YongdongWang's picture
Upload folder using huggingface_hub
92ef79b verified
# πŸ“ Enhanced Editing Workflow Guide
## πŸ”§ Fixed Issues
### βœ… Persistent Editing Problem Solved
- **Issue**: After updating DAG, editor showed empty `{"tasks": []}` on subsequent edits
- **Solution**: Enhanced state management to preserve task plans across edit cycles
- **Result**: Task plans now persist through the complete workflow
## πŸš€ Complete Workflow
### 1️⃣ **LLM Generation Phase**
```
User Input β†’ LLM Response β†’ DAG Generated β†’ Buttons Appear
```
**Buttons shown**: `πŸ“ Edit Task Plan` + `πŸ”’ Validate & Deploy Task Plan`
### 2️⃣ **Manual Editing Phase** (Optional)
```
Click "πŸ“ Edit Task Plan" β†’ JSON Editor Opens β†’ Make Changes
```
**Buttons shown**: `πŸ”„ Update DAG Visualization`
### 3️⃣ **DAG Update Phase**
```
Click "πŸ”„ Update DAG Visualization" β†’ New DAG Generated β†’ Review Changes
```
**Buttons shown**: `πŸ”’ Validate & Deploy Task Plan`
### 4️⃣ **Deployment Phase**
```
Click "πŸ”’ Validate & Deploy Task Plan" β†’ Send to ROS Topics β†’ Confirmation
```
**Status**: `βœ… Task Plan Successfully Deployed`
### 5️⃣ **Re-editing Capability**
```
Click "πŸ“ Edit Task Plan" Again β†’ Previous Plan Loads β†’ Continue Editing
```
**Feature**: Deployed plans can be re-edited and updated
## 🎯 Key Features
### πŸ”„ **Persistent State Management**
- βœ… Task plans persist across edit cycles
- βœ… Deployed plans remain available for re-editing
- βœ… Intelligent fallback to templates when needed
- βœ… Proper error handling for malformed data
### πŸ“‹ **Smart Editor Behavior**
- **With existing plan**: Shows current task JSON for editing
- **After deployment**: Shows deployed plan for potential re-editing
- **Empty state**: Shows example template with proper structure
- **Malformed data**: Gracefully falls back to template
### πŸ›‘οΈ **Error Handling**
- **JSON Syntax Errors**: Shows clear error messages and keeps editor open
- **Missing Fields**: Validates required structure (`tasks` field)
- **Empty Tasks**: Handles empty task arrays gracefully
- **State Corruption**: Recovers with template when state is invalid
## πŸ“Š Example JSON Structure
```json
{
"tasks": [
{
"task": "excavate_soil_from_pile",
"instruction_function": {
"name": "excavate_soil_from_pile",
"robot_ids": ["robot_excavator_01"],
"dependencies": [],
"object_keywords": ["soil_pile"]
}
},
{
"task": "transport_soil_to_pit",
"instruction_function": {
"name": "transport_soil_to_pit",
"robot_ids": ["robot_dump_truck_01"],
"dependencies": ["excavate_soil_from_pile"],
"object_keywords": ["pit"]
}
}
]
}
```
## πŸ” Testing Commands
### Run the Application
```bash
cd /root/share/QA_LLM_Module
python3 main.py
```
### Monitor ROS Topics
```bash
./monitor_topics.sh
```
### Test Editing Workflow
```bash
python3 test_persistent_editing.py
```
## πŸŽ‰ Success Indicators
### βœ… Working Correctly When:
1. **First Edit**: LLM plan loads in editor
2. **Update DAG**: New visualization appears
3. **Deploy**: Confirmation message shows
4. **Re-edit**: Previous plan content loads (not empty template)
5. **Multiple Cycles**: Can edit β†’ update β†’ deploy repeatedly
### πŸ”§ Troubleshooting
#### Problem: Editor shows empty tasks
- **Cause**: State management issue
- **Solution**: Fixed with enhanced persistence logic
#### Problem: DAG not updating
- **Cause**: JSON syntax error
- **Solution**: Check error message, fix JSON, try again
#### Problem: Cannot deploy
- **Cause**: ROS node not initialized
- **Solution**: Restart application, check ROS connection
## πŸ† Benefits
1. **Enhanced Safety**: Multiple review opportunities before deployment
2. **Flexibility**: Manual fine-tuning of LLM-generated plans
3. **Persistence**: No loss of work during editing cycles
4. **User-Friendly**: Clear status messages and error handling
5. **IEEE Compliant**: Professional terminology and workflow