glchat-plugin 0.3.7__py3-none-any.whl → 0.3.9__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 +21 -0
- glchat_plugin/pipeline/base_pipeline_preset_config.py +2 -0
- glchat_plugin/service/base_user_service.py +16 -0
- {glchat_plugin-0.3.7.dist-info → glchat_plugin-0.3.9.dist-info}/METADATA +1 -1
- {glchat_plugin-0.3.7.dist-info → glchat_plugin-0.3.9.dist-info}/RECORD +7 -7
- {glchat_plugin-0.3.7.dist-info → glchat_plugin-0.3.9.dist-info}/WHEEL +0 -0
- {glchat_plugin-0.3.7.dist-info → glchat_plugin-0.3.9.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Provides a class for context manager.
|
|
2
2
|
|
|
3
3
|
Authors:
|
|
4
|
+
Ricky Setiawan (ricky.setiawan@gdplabs.id)
|
|
4
5
|
Ryan Ignatius Hadiwijaya (ryan.i.hadiwijaya@gdplabs.id)
|
|
5
6
|
|
|
6
7
|
References:
|
|
@@ -8,6 +9,7 @@ References:
|
|
|
8
9
|
"""
|
|
9
10
|
|
|
10
11
|
from contextvars import ContextVar
|
|
12
|
+
from typing import Any
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
class ContextManager:
|
|
@@ -18,6 +20,7 @@ class ContextManager:
|
|
|
18
20
|
|
|
19
21
|
_tenant: ContextVar[str | None] = ContextVar("tenant_id", default=None)
|
|
20
22
|
_user: ContextVar[str | None] = ContextVar("user_id", default=None)
|
|
23
|
+
_user_session: ContextVar[Any | None] = ContextVar("user_session", default=None)
|
|
21
24
|
|
|
22
25
|
@classmethod
|
|
23
26
|
def set_tenant(cls, tenant_id: str | None) -> None:
|
|
@@ -55,3 +58,21 @@ class ContextManager:
|
|
|
55
58
|
str | None: The user id.
|
|
56
59
|
"""
|
|
57
60
|
return cls._user.get()
|
|
61
|
+
|
|
62
|
+
@classmethod
|
|
63
|
+
def set_user_session(cls, user_session: Any | None) -> None:
|
|
64
|
+
"""Set the user session in the context.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
user_session (Any | None): The user session.
|
|
68
|
+
"""
|
|
69
|
+
cls._user_session.set(user_session)
|
|
70
|
+
|
|
71
|
+
@classmethod
|
|
72
|
+
def get_user_session(cls) -> Any | None:
|
|
73
|
+
"""Get the user session from the context.
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
Any | None: The user session.
|
|
77
|
+
"""
|
|
78
|
+
return cls._user_session.get()
|
|
@@ -46,6 +46,7 @@ class BasePipelinePresetConfig(BaseModel):
|
|
|
46
46
|
anonymize_lm (bool): Whether to anonymize before using the language model.
|
|
47
47
|
prompt_context_char_threshold (int): The character limit above which the prompt is assumed
|
|
48
48
|
to have contained the context.
|
|
49
|
+
enable_standalone_query (bool): Whether to enable standalone query.
|
|
49
50
|
"""
|
|
50
51
|
|
|
51
52
|
pipeline_preset_id: str
|
|
@@ -70,3 +71,4 @@ class BasePipelinePresetConfig(BaseModel):
|
|
|
70
71
|
anonymize_em: bool
|
|
71
72
|
anonymize_lm: bool
|
|
72
73
|
prompt_context_char_threshold: int
|
|
74
|
+
enable_standalone_query: bool = True
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Authors:
|
|
4
4
|
Immanuel Rhesa (immanuel.rhesa@gdplabs.id)
|
|
5
5
|
Hermes Vincentius Gani (hermes.v.gani@gdplabs.id)
|
|
6
|
+
Ricky Setiawan (ricky.setiawan@gdplabs.id)
|
|
6
7
|
|
|
7
8
|
References:
|
|
8
9
|
NONE
|
|
@@ -30,6 +31,21 @@ class BaseUserService(ABC):
|
|
|
30
31
|
"""
|
|
31
32
|
raise NotImplementedError
|
|
32
33
|
|
|
34
|
+
@abstractmethod
|
|
35
|
+
async def get_user_session(self, **kwargs: Any) -> Any | None:
|
|
36
|
+
"""Abstract method to get the user session.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
**kwargs (Any): Additional keyword arguments for user session retrieval.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
Any | None: User session, None if not found.
|
|
43
|
+
|
|
44
|
+
Raises:
|
|
45
|
+
NotImplementedError: If the method is not implemented.
|
|
46
|
+
"""
|
|
47
|
+
raise NotImplementedError
|
|
48
|
+
|
|
33
49
|
@abstractmethod
|
|
34
50
|
async def register(self, **kwargs: Any):
|
|
35
51
|
"""Abstract method to register a new user.
|
|
@@ -3,23 +3,23 @@ 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=DB6-XlINqhRU6qGrDbOA7OSMk9uiq4l2nYYMVjEnDTY,3590
|
|
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=dQUbejXUMrYwLo8xPGo1P-QWuMYPahmRddAx8Ig-fJE,1968
|
|
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
|
|
10
|
-
glchat_plugin/pipeline/base_pipeline_preset_config.py,sha256=
|
|
10
|
+
glchat_plugin/pipeline/base_pipeline_preset_config.py,sha256=lbMH8y_HU3LrqtMYXLzQ2906ZkMXARKY5vBuIGvRVdA,2969
|
|
11
11
|
glchat_plugin/pipeline/pipeline_handler.py,sha256=CrC4PU5nLU-7QkebUMUsK4M3R55MwvXiX4tNiyb9_HE,29273
|
|
12
12
|
glchat_plugin/pipeline/pipeline_plugin.py,sha256=fozvxVrOphgwLIF7uPrEkF8ZQcu8xgifYAQyuxj9628,4393
|
|
13
13
|
glchat_plugin/service/__init__.py,sha256=9T4qzyYL052qLqva5el1F575OTRNaaf9tb9UvW-leTc,47
|
|
14
14
|
glchat_plugin/service/base_rate_limiter_service.py,sha256=tgKwdr4EqnGo5iDRVJPnlg8W9q0hiUzfeewAtdW4IjU,1232
|
|
15
15
|
glchat_plugin/service/base_tenant_service.py,sha256=CB-jJWXi87nTcjO1XhPoSgNMf2YA_LfXoHr30ye0VtI,734
|
|
16
|
-
glchat_plugin/service/base_user_service.py,sha256=
|
|
16
|
+
glchat_plugin/service/base_user_service.py,sha256=DlVj0pimzTgvgz2dqpVkfhMK8PWEwQ9LyukzGoVZgYc,2703
|
|
17
17
|
glchat_plugin/storage/__init__.py,sha256=VNO7ua2yAOLzXwe6H6zDZz9yXbhQfKqNJzxE3G8IyfA,50
|
|
18
18
|
glchat_plugin/storage/base_anonymizer_storage.py,sha256=oFwovWrsjM7v1YjeN-4p-M3OGnAeo_Y7-9xqlToI180,1969
|
|
19
19
|
glchat_plugin/storage/base_chat_history_storage.py,sha256=YIGM8zv7s5BQ8O7W1LfaLyQW4SF9Bt3aolowsoDaQw8,11257
|
|
20
20
|
glchat_plugin/tools/__init__.py,sha256=OFotHbgQ8mZEbdlvlv5aVMdxfubPvkVWAcTwhIPdIqQ,542
|
|
21
21
|
glchat_plugin/tools/decorators.py,sha256=AvQBV18wzXWdC483RSSmpfh92zsqTyp8SzDLIkreIGU,3925
|
|
22
|
-
glchat_plugin-0.3.
|
|
23
|
-
glchat_plugin-0.3.
|
|
24
|
-
glchat_plugin-0.3.
|
|
25
|
-
glchat_plugin-0.3.
|
|
22
|
+
glchat_plugin-0.3.9.dist-info/METADATA,sha256=zHRA5hr9fFHpYkB4zYwVBH5grycLifJ47ipCIZL1omw,2063
|
|
23
|
+
glchat_plugin-0.3.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
24
|
+
glchat_plugin-0.3.9.dist-info/top_level.txt,sha256=fzKSXmct5dY4CAKku4-mkdHX-QPAyQVvo8vpQj8qizY,14
|
|
25
|
+
glchat_plugin-0.3.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|