diff --git a/ai-hub/app/api/routes/sessions.py b/ai-hub/app/api/routes/sessions.py index 9b04867..1d6504b 100644 --- a/ai-hub/app/api/routes/sessions.py +++ b/ai-hub/app/api/routes/sessions.py @@ -405,6 +405,17 @@ if not session: raise HTTPException(status_code=404, detail="Session not found.") + if not session.sync_workspace_id and session.feature_name == "swarm_control": + import uuid + session.sync_workspace_id = f"session-{session.id}-{uuid.uuid4().hex[:8]}" + db.commit() + db.refresh(session) + try: + if services and hasattr(services, "orchestrator") and services.orchestrator.mirror: + services.orchestrator.mirror.get_workspace_path(session.sync_workspace_id) + except Exception: + pass + registry = services.node_registry_service sync_status = session.node_sync_status or {} entries = [] diff --git a/ai-hub/app/core/services/session.py b/ai-hub/app/core/services/session.py index 39c6fc6..5c6669b 100644 --- a/ai-hub/app/core/services/session.py +++ b/ai-hub/app/core/services/session.py @@ -49,6 +49,8 @@ if request.feature_name == "swarm_control" or default_nodes: session.sync_workspace_id = f"session-{session.id}-{uuid.uuid4().hex[:8]}" + db.commit() + db.refresh(session) try: if self.services and hasattr(self.services, "orchestrator") and self.services.orchestrator.mirror: diff --git a/frontend/src/features/swarm/components/SwarmControlOverlays.js b/frontend/src/features/swarm/components/SwarmControlOverlays.js index 9744cdb..ce96a04 100644 --- a/frontend/src/features/swarm/components/SwarmControlOverlays.js +++ b/frontend/src/features/swarm/components/SwarmControlOverlays.js @@ -46,7 +46,7 @@ attachedNodeIds, setShowFileExplorer }) => { - if (!showFileExplorer || !workspaceId || attachedNodeIds.length === 0) return null; + if (!showFileExplorer || !workspaceId) return null; return ( <> @@ -62,7 +62,7 @@ 0 ? attachedNodeIds[0] : null} sessionId={workspaceId} initialPath="." showSyncStatus={true} diff --git a/frontend/src/features/swarm/pages/SwarmControlPage.js b/frontend/src/features/swarm/pages/SwarmControlPage.js index 524ae43..d317ae7 100644 --- a/frontend/src/features/swarm/pages/SwarmControlPage.js +++ b/frontend/src/features/swarm/pages/SwarmControlPage.js @@ -438,7 +438,8 @@ )} - {attachedNodeIds.length > 0 && ( + + {workspaceId && (