glchat-plugin 0.4.7__py3-none-any.whl → 0.4.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- glchat_plugin/context/context_manager.py +27 -0
- {glchat_plugin-0.4.7.dist-info → glchat_plugin-0.4.8.dist-info}/METADATA +1 -1
- {glchat_plugin-0.4.7.dist-info → glchat_plugin-0.4.8.dist-info}/RECORD +5 -5
- {glchat_plugin-0.4.7.dist-info → glchat_plugin-0.4.8.dist-info}/WHEEL +0 -0
- {glchat_plugin-0.4.7.dist-info → glchat_plugin-0.4.8.dist-info}/top_level.txt +0 -0
|
@@ -21,6 +21,7 @@ class ContextManager:
|
|
|
21
21
|
_tenant: ContextVar[str | None] = ContextVar("tenant_id", default=None)
|
|
22
22
|
_user: ContextVar[str | None] = ContextVar("user_id", default=None)
|
|
23
23
|
_user_session: ContextVar[Any | None] = ContextVar("user_session", default=None)
|
|
24
|
+
_request_id: ContextVar[str | None] = ContextVar("request_id", default=None)
|
|
24
25
|
|
|
25
26
|
@classmethod
|
|
26
27
|
def set_tenant(cls, tenant_id: str | None) -> None:
|
|
@@ -76,3 +77,29 @@ class ContextManager:
|
|
|
76
77
|
Any | None: The user session.
|
|
77
78
|
"""
|
|
78
79
|
return cls._user_session.get()
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def set_request_id(cls, request_id: str | None) -> None:
|
|
83
|
+
"""Set the request id in the context.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
request_id (str | None): The request id.
|
|
87
|
+
"""
|
|
88
|
+
cls._request_id.set(request_id)
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def get_request_id(cls) -> str | None:
|
|
92
|
+
"""Get the request id from the context.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
str | None: The request id.
|
|
96
|
+
"""
|
|
97
|
+
return cls._request_id.get()
|
|
98
|
+
|
|
99
|
+
@classmethod
|
|
100
|
+
def clear(cls) -> None:
|
|
101
|
+
"""Clear the context."""
|
|
102
|
+
cls._tenant.set(None)
|
|
103
|
+
cls._user.set(None)
|
|
104
|
+
cls._user_session.set(None)
|
|
105
|
+
cls._request_id.set(None)
|
|
@@ -3,7 +3,7 @@ glchat_plugin/config/__init__.py,sha256=DNnX8B_TvAN89oyMgq32zG1DeaezODrihiAXTwOP
|
|
|
3
3
|
glchat_plugin/config/app_config.py,sha256=9_ShYtaQ7Rp14sSkrIFLoOAMlbwVlm13EuCxzOn4NCI,426
|
|
4
4
|
glchat_plugin/config/constant.py,sha256=zZO4WCkozvm6i_rMquTp99Q3alom0SN_P9SNqAHO3ko,3621
|
|
5
5
|
glchat_plugin/context/__init__.py,sha256=3Wx_apMIS6z-m6eRs6hoyOsJFLJfKmMFOkrPDkPQfJI,40
|
|
6
|
-
glchat_plugin/context/context_manager.py,sha256=
|
|
6
|
+
glchat_plugin/context/context_manager.py,sha256=4UWsdXV-5JkVfwltxR1PxIYiPpodhxo-CTo8am4qVQ8,2717
|
|
7
7
|
glchat_plugin/handler/__init__.py,sha256=H5DJaAfwwtRsvMcOaEzHfGMQk25H7la0E7uPfksWtoQ,40
|
|
8
8
|
glchat_plugin/handler/base_post_login_handler.py,sha256=48xSbe_LwTCjRY-lCuzWXqbnEr1ql8bAhQih1Xeh8f8,2835
|
|
9
9
|
glchat_plugin/pipeline/__init__.py,sha256=Sk-NfIGyA9VKIg0Bt5OHatNUYyWVPh9i5xhE5DFAfbo,41
|
|
@@ -20,7 +20,7 @@ glchat_plugin/storage/base_anonymizer_storage.py,sha256=oFwovWrsjM7v1YjeN-4p-M3O
|
|
|
20
20
|
glchat_plugin/storage/base_chat_history_storage.py,sha256=YIGM8zv7s5BQ8O7W1LfaLyQW4SF9Bt3aolowsoDaQw8,11257
|
|
21
21
|
glchat_plugin/tools/__init__.py,sha256=OFotHbgQ8mZEbdlvlv5aVMdxfubPvkVWAcTwhIPdIqQ,542
|
|
22
22
|
glchat_plugin/tools/decorators.py,sha256=AvQBV18wzXWdC483RSSmpfh92zsqTyp8SzDLIkreIGU,3925
|
|
23
|
-
glchat_plugin-0.4.
|
|
24
|
-
glchat_plugin-0.4.
|
|
25
|
-
glchat_plugin-0.4.
|
|
26
|
-
glchat_plugin-0.4.
|
|
23
|
+
glchat_plugin-0.4.8.dist-info/METADATA,sha256=OrcPV4yUK-F1k5xq4o7Z_SwOhKq_x1AHbq_jAcerqwk,2063
|
|
24
|
+
glchat_plugin-0.4.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
25
|
+
glchat_plugin-0.4.8.dist-info/top_level.txt,sha256=fzKSXmct5dY4CAKku4-mkdHX-QPAyQVvo8vpQj8qizY,14
|
|
26
|
+
glchat_plugin-0.4.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|