MCPcopy
hub / github.com/wandb/openui / get

Method get

backend/openui/session.py:35–55  ·  view source on GitHub ↗
(self, session_id: str)

Source from the content-addressed store, hash-verified

33 return Session.get_or_none(Session.id == uuid.UUID(session_id).bytes)
34
35 def get(self, session_id: str) -> Optional[SessionData]:
36 if session_id:
37 session = Session.get_or_none(Session.id == uuid.UUID(session_id).bytes)
38 else:
39 session = None
40 if session is None:
41 return SessionData(
42 token_count=0,
43 username="",
44 max_tokens=config.MAX_TOKENS,
45 email=get_git_user_email(),
46 )
47 else:
48 day_ago = datetime.datetime.now() - datetime.timedelta(days=1)
49 token_count = Usage.tokens_since(str(session.user_id), day_ago.date())
50 return SessionData(
51 username=session.user.username,
52 email=session.user.email,
53 token_count=token_count,
54 max_tokens=config.MAX_TOKENS,
55 )
56
57 def write(self, session_id: str, user_id: str, data: SessionData):
58 Session.insert(

Callers 15

HistoryFunction · 0.80
SettingsFunction · 0.80
PromptFunction · 0.80
RegisterFunction · 0.80
handlers.tsFile · 0.80
getRandomPhotoFunction · 0.80
authenticateFunction · 0.80
authFunction · 0.80
test_read_mainFunction · 0.80
dummy_stream_generatorFunction · 0.80
chat_completionsFunction · 0.80
boto3_error_handlerFunction · 0.80

Calls 3

tokens_sinceMethod · 0.80
SessionDataClass · 0.70
get_git_user_emailFunction · 0.50

Tested by 1

test_read_mainFunction · 0.64