-
Notifications
You must be signed in to change notification settings - Fork 371
feat: Json upload ui and validations + Planpage uistreaming #396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
31fabc3
feat: Enhanced team settings UI and upload functionality
blessing-sanusi f7a7500
feat: add WebSocket streaming for real-time plan execution
blessing-sanusi 6b108e4
fix: correct Azure AI Foundry authentication scope
blessing-sanusi bdc35c7
fix: improve team upload UX and delete dialog styling
blessing-sanusi 9da99bd
docs: add test files and documentation
blessing-sanusi aacfc00
team selection icon
blessing-sanusi d36d30e
fix: eliminate horizontal scrollbar in team selection dialog
blessing-sanusi ac77a25
feat: improve quick task card layout with side-by-side icon and title
blessing-sanusi 420af21
chore: remove cached WebSocket_Streaming_Summary.md file
blessing-sanusi 8d492a4
refactor: move utility files to common/utils folder
blessing-sanusi aaec69d
refactor: move all imports to top of check_deployments.py
blessing-sanusi b82035d
refactor: clean up check_deployments.py output
blessing-sanusi 5a1f7b9
refactor: move Azure Management scope to config and organize imports
blessing-sanusi b39c7f4
feat: integrate coral toast system into HomePage
blessing-sanusi b3c9fa4
cleanup: remove test team configuration files
blessing-sanusi 5596b51
fix: update PlanMessage interface to include streaming properties
blessing-sanusi c09dbb3
cleanup: comment out unused GenericChatMessage and MessageRole interf…
blessing-sanusi c4d6173
Merge branch 'macae-v3-dev' into planpage-uistreaming
blessing-sanusi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
# WebSocket Streaming Implementation Summary | ||
|
||
## 🎯 Overview | ||
Complete WebSocket streaming functionality for real-time plan execution updates in the Multi-Agent Custom Automation Engine. | ||
|
||
## ✅ Frontend Files Added/Modified | ||
|
||
### New Files | ||
- `src/frontend/src/services/WebSocketService.tsx` - Core WebSocket client | ||
- `src/backend/websocket_streaming.py` - Backend WebSocket server | ||
|
||
### Modified Files | ||
- `src/frontend/src/pages/PlanPage.tsx` - WebSocket integration | ||
- `src/frontend/src/components/content/PlanChat.tsx` - Live message display | ||
- `src/frontend/src/models/plan.tsx` - Updated interfaces | ||
- `src/frontend/src/styles/PlanChat.css` - Streaming styles | ||
- `src/backend/app_kernel.py` - WebSocket endpoint | ||
|
||
## 🔧 Key Features Implemented | ||
|
||
### WebSocket Service (`WebSocketService.tsx`) | ||
- Auto-connection to `ws://127.0.0.1:8000/ws/streaming` | ||
- Exponential backoff reconnection (max 5 attempts) | ||
- Plan subscription system (`subscribe_plan`, `unsubscribe_plan`) | ||
- Event-based message handling | ||
- Connection status tracking | ||
|
||
### Plan Page (`PlanPage.tsx`) | ||
- WebSocket initialization on mount | ||
- Plan subscription when viewing specific plan | ||
- Streaming message state management | ||
- Connection status tracking | ||
- useRef pattern to avoid circular dependencies | ||
|
||
### Chat Interface (`PlanChat.tsx`) | ||
- Real-time message display | ||
- Connection status indicator ("Real-time updates active") | ||
- Message type indicators: | ||
- 🧠 "Thinking..." (thinking messages) | ||
- ⚡ "Acting..." (action messages) | ||
- ⚙️ "Working..." (in_progress status) | ||
- Auto-scroll for new messages | ||
- Pulse animation for streaming messages | ||
|
||
### Styling (`PlanChat.css`) | ||
- Connection status styling (green success indicator) | ||
- Streaming message animations (pulse effect) | ||
- Visual feedback for live updates | ||
|
||
## 📡 Message Format | ||
|
||
### Expected WebSocket Messages | ||
```json | ||
{ | ||
"type": "plan_update|step_update|agent_message", | ||
"data": { | ||
"plan_id": "your-plan-id", | ||
"agent_name": "Data Analyst", | ||
"content": "I'm analyzing the data...", | ||
"message_type": "thinking|action|result", | ||
"status": "in_progress|completed|error", | ||
"step_id": "optional-step-id" | ||
} | ||
} | ||
``` | ||
|
||
### Client Subscription Messages | ||
```json | ||
{"type": "subscribe_plan", "plan_id": "plan-123"} | ||
{"type": "unsubscribe_plan", "plan_id": "plan-123"} | ||
``` | ||
|
||
## 🔌 Backend Integration Points | ||
|
||
### FastAPI WebSocket Endpoint | ||
```python | ||
@app.websocket("/ws/streaming") | ||
async def websocket_endpoint(websocket: WebSocket): | ||
await websocket_streaming_endpoint(websocket) | ||
``` | ||
|
||
### Message Broadcasting Functions | ||
- `send_plan_update(plan_id, step_id, agent_name, content, status, message_type)` | ||
- `send_agent_message(plan_id, agent_name, content, message_type)` | ||
- `send_step_update(plan_id, step_id, status, content)` | ||
|
||
## 🎨 Visual Elements | ||
|
||
### Connection Status | ||
- Green tag: "Real-time updates active" when connected | ||
- Auto-hide when disconnected | ||
|
||
### Message Types | ||
- **Thinking**: Agent processing/analyzing | ||
- **Action**: Agent performing task | ||
- **Result**: Agent completed action | ||
- **In Progress**: Ongoing work indicator | ||
|
||
### Animations | ||
- Pulse effect for streaming messages | ||
- Auto-scroll to latest content | ||
- Smooth transitions for status changes | ||
|
||
## 🧪 Testing | ||
|
||
### Test Endpoint | ||
`POST /api/test/streaming/{plan_id}` - Triggers sample streaming messages | ||
|
||
### Frontend Testing | ||
1. Navigate to any plan page (`http://127.0.0.1:3001/plan/your-plan-id`) | ||
2. Look for green "Real-time updates active" indicator | ||
3. Check browser console for WebSocket connection logs | ||
4. Trigger test messages via API endpoint | ||
|
||
### Console Debug Messages | ||
```javascript | ||
"Connecting to WebSocket: ws://127.0.0.1:8000/ws/streaming" | ||
"WebSocket connected" | ||
"Subscribed to plan updates: plan-123" | ||
"WebSocket message received: {...}" | ||
``` | ||
|
||
## 🔄 Message Flow | ||
|
||
1. **Page Load**: WebSocket connects automatically | ||
2. **Plan View**: Subscribe to specific plan updates | ||
3. **Backend Execution**: Send streaming messages during plan execution | ||
4. **Frontend Display**: Show messages instantly with appropriate styling | ||
5. **Auto-scroll**: Keep latest content visible | ||
6. **Cleanup**: Unsubscribe and disconnect when leaving page | ||
|
||
## 💡 Key Benefits | ||
|
||
- **Real-time Feedback**: See agent thoughts and actions as they happen | ||
- **Better UX**: Interactive feel during plan execution | ||
- **Visual Indicators**: Clear status communication | ||
- **Robust Connection**: Auto-reconnection and error handling | ||
- **Scalable**: Support for multiple concurrent plan streams | ||
- **Graceful Degradation**: Works without WebSocket if unavailable | ||
|
||
## 🎯 Ready for Production | ||
|
||
The frontend streaming implementation is complete and ready for backend integration. When the backend implements WebSocket streaming, the UI will immediately show: | ||
|
||
- Live agent conversations | ||
- Step-by-step progress updates | ||
- Real-time status indicators | ||
- Interactive plan execution experience | ||
|
||
## 📋 Git Commit Summary | ||
|
||
Files staged for commit: | ||
- ✅ `src/backend/app_kernel.py` (WebSocket endpoint) | ||
- ✅ `src/backend/websocket_streaming.py` (WebSocket server) | ||
- ✅ `src/frontend/src/services/WebSocketService.tsx` (WebSocket client) | ||
- ✅ `src/frontend/src/pages/PlanPage.tsx` (Streaming integration) | ||
- ✅ `src/frontend/src/components/content/PlanChat.tsx` (Live messages) | ||
- ✅ `src/frontend/src/models/plan.tsx` (Updated interfaces) | ||
- ✅ `src/frontend/src/styles/PlanChat.css` (Streaming styles) | ||
|
||
## 🚀 Next Steps | ||
|
||
1. Backend team implements WebSocket message broadcasting in plan execution logic | ||
2. Frontend immediately shows live streaming without additional changes | ||
3. Test with real plan execution scenarios | ||
4. Monitor performance and optimize if needed | ||
5. Consider adding message persistence for long-running plans | ||
|
||
--- | ||
*Implementation completed on planpage-uistreaming branch* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blessing-sanusi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import asyncio | ||
import sys | ||
import os | ||
|
||
# Add the backend directory to the Python path | ||
backend_path = os.path.join(os.path.dirname(__file__)) | ||
sys.path.insert(0, backend_path) | ||
|
||
try: | ||
from v3.common.services.foundry_service import FoundryService | ||
blessing-sanusi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
async def check_deployments(): | ||
try: | ||
print("🔍 Checking Azure AI Foundry model deployments...") | ||
foundry_service = FoundryService() | ||
deployments = await foundry_service.list_model_deployments() | ||
|
||
print("\n📋 Raw deployments found:") | ||
for i, deployment in enumerate(deployments, 1): | ||
name = deployment.get('name', 'Unknown') | ||
status = deployment.get('status', 'Unknown') | ||
model_name = deployment.get('model', {}).get('name', 'Unknown') | ||
print(f" {i}. Name: {name}, Status: {status}, Model: {model_name}") | ||
|
||
print(f"\n✅ Total deployments: {len(deployments)}") | ||
|
||
# Filter successful deployments | ||
successful_deployments = [ | ||
d for d in deployments | ||
if d.get('status') == 'Succeeded' | ||
] | ||
|
||
print(f"✅ Successful deployments: {len(successful_deployments)}") | ||
|
||
available_models = [ | ||
d.get('name', '').lower() | ||
for d in successful_deployments | ||
] | ||
|
||
print(f"\n🎯 Available model names (lowercase): {available_models}") | ||
|
||
# Check what we're looking for | ||
required_models = ['gpt-4o', 'o3', 'gpt-4', 'gpt-35-turbo'] | ||
print(f"\n🔍 Checking for required models: {required_models}") | ||
|
||
for model in required_models: | ||
if model.lower() in available_models: | ||
print(f'✅ {model} is available') | ||
else: | ||
print(f'❌ {model} is NOT found in available models') | ||
|
||
except Exception as e: | ||
print(f'❌ Error: {e}') | ||
import traceback | ||
traceback.print_exc() | ||
|
||
if __name__ == "__main__": | ||
asyncio.run(check_deployments()) | ||
|
||
except ImportError as e: | ||
print(f"❌ Import error: {e}") | ||
print("Make sure you're running this from the correct directory with the virtual environment activated.") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.