demo / backend /session.py
Pierre Andrews
Initial commit
f52d137
from dataclasses import asdict, dataclass
@dataclass
class UserSession:
"""Information associated with the current user's session.
port: on which port is ARE running
pid: ARE process pid to check status
sid: Session id in ARE
model: User selected model
provider: User selected provider
log_path: ARE log for the session
start_time: Session start time
user: Username
sign: User sign in # todo: remove when the space becomes public
"""
port: int
pid: int
sid: str
model: str
provider: str
log_path: str
start_time: str
user: str
sign: str
def log_name(self) -> str:
return f"{self.provider}/{self.model}/{self.user}_{self.start_time}_log.json"
def asdict(self) -> dict:
return asdict(self)