fix
Browse files412 unmodified lines4134144154164164174184194204214214224234247 unmodified lines432433434435436437438439435436440441442443444445446412 unmodified lines"""
def extract_space_id_from_history(history: Optional[List[Dict]], username: Optional[str] = None) -> Optional[str]:def extract_space_id_from_history(history: Optional[List], username: Optional[str] = None) -> Optional[str]: """ Extract existing space ID from chat history (for updates after followups/imports) Args: history: Chat history (list of dicts with 'role' and 'content') history: Chat history (list of lists [[role, content], ...] or list of dicts) username: Current username (to verify ownership of imported spaces) Returns:7 unmodified lines # Look through history for previous deployments or imports for msg in history: # Handle both list format [[role, content], ...] and dict format [{'role': ..., 'content': ...}, ...] if isinstance(msg, list) and len(msg) >= 2: role = msg[0] content = msg[1] elif isinstance(msg, dict): role = msg.get('role', '') content = msg.get('content', '') role = msg.get('role', '') content = msg.get('content', '') else: continue # Check assistant messages for deployment confirmations if role == 'assistant':backend_deploy.py+11-4