File size: 798 Bytes
f52d137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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)