MCPcopy Create free account
hub / github.com/modelscope/ms-agent / create_session

Method create_session

webui/backend/session_manager.py:22–48  ·  view source on GitHub ↗

Create a new session

(self,
                       project_id: str,
                       project_name: str,
                       workflow_type: str = 'standard',
                       session_type: str = 'project')

Source from the content-addressed store, hash-verified

20 self._lock = Lock()
21
22 def create_session(self,
23 project_id: str,
24 project_name: str,
25 workflow_type: str = 'standard',
26 session_type: str = 'project') -> Dict[str, Any]:
27 """Create a new session"""
28 session_id = str(uuid.uuid4())
29 session = {
30 'id': session_id,
31 'project_id': project_id,
32 'project_name': project_name,
33 'status': 'idle', # idle, running, completed, error
34 'created_at': datetime.now().isoformat(),
35 'workflow_progress': None,
36 'file_progress': None,
37 'current_step': None,
38 'workflow_type': workflow_type, # 'standard' or 'simple'
39 'session_type': session_type # 'project' or 'chat'
40 }
41
42 with self._lock:
43 self._sessions[session_id] = session
44 self._messages[session_id] = []
45 self._dr_events[session_id] = []
46 self._dr_event_counters[session_id] = 0
47
48 return session
49
50 def get_session(self, session_id: str) -> Optional[Dict[str, Any]]:
51 """Get session by ID"""

Callers 1

create_sessionFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected