glchat-plugin 0.3.5__py3-none-any.whl → 0.3.7__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.
@@ -20,11 +20,11 @@ class ContextManager:
20
20
  _user: ContextVar[str | None] = ContextVar("user_id", default=None)
21
21
 
22
22
  @classmethod
23
- def set_tenant(cls, tenant_id: str) -> None:
23
+ def set_tenant(cls, tenant_id: str | None) -> None:
24
24
  """Set the tenant id in the context.
25
25
 
26
26
  Args:
27
- tenant_id (str): The tenant id.
27
+ tenant_id (str | None): The tenant id.
28
28
  """
29
29
  cls._tenant.set(tenant_id)
30
30
 
@@ -39,11 +39,11 @@ class ContextManager:
39
39
  return tenant_id
40
40
 
41
41
  @classmethod
42
- def set_user(cls, user_id: str) -> None:
42
+ def set_user(cls, user_id: str | None) -> None:
43
43
  """Set the user id in the context.
44
44
 
45
45
  Args:
46
- user_id (str): The user id.
46
+ user_id (str | None): The user id.
47
47
  """
48
48
  cls._user.set(user_id)
49
49
 
@@ -205,11 +205,18 @@ class PipelineHandler(PluginHandler):
205
205
  pipeline_key = (chatbot_id, f"__{pipeline_type}__")
206
206
  instance._chatbot_pipeline_keys.setdefault(chatbot_id, set()).add(pipeline_key)
207
207
  instance._pipeline_cache[pipeline_key] = pipeline
208
+
209
+ # Clear any previous error for this internal pipeline if build succeeded
210
+ instance._pipeline_build_errors.pop(pipeline_key, None)
208
211
  except Exception as e:
209
- logger.warning(f"Failed when ainit plugin {traceback.format_exc()}")
210
- logger.warning(
212
+ error_message = (
211
213
  f"Error building internal pipeline `{pipeline_type}` for chatbot `{chatbot_id}`: {e}"
212
214
  )
215
+ logger.warning(f"Failed when ainit plugin {traceback.format_exc()}")
216
+ logger.warning(error_message)
217
+
218
+ # Store the error message for later retrieval
219
+ instance._store_pipeline_build_error(chatbot_id, f"__{pipeline_type}__", error_message)
213
220
 
214
221
  for model in supported_models:
215
222
  try:
@@ -270,12 +270,13 @@ class BaseChatHistoryStorage(ABC):
270
270
  pass
271
271
 
272
272
  @abstractmethod
273
- def update_conversation_document(
273
+ def update_conversation_document( # noqa: PLR0913
274
274
  self,
275
275
  document_id: str,
276
276
  status: str,
277
277
  number_of_chunks: int,
278
278
  message: str | None,
279
+ error_type: str | None,
279
280
  object_key: str | None,
280
281
  **kwargs: Any,
281
282
  ) -> ConversationDocument:
@@ -286,6 +287,7 @@ class BaseChatHistoryStorage(ABC):
286
287
  status (str): The status of the document.
287
288
  number_of_chunks (int): The number of chunks in the document.
288
289
  message (str | None, optional): A message associated with the document. Defaults to None.
290
+ error_type (str | None, optional): The type of error associated with the document. Defaults to None.
289
291
  object_key (str | None, optional): The object key of the document. Defaults to None.
290
292
  kwargs (Any): Additional arguments.
291
293
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: glchat-plugin
3
- Version: 0.3.5
3
+ Version: 0.3.7
4
4
  Author-email: GenAI SDK Team <gat-sdk@gdplabs.id>
5
5
  Requires-Python: <3.13,>=3.11
6
6
  Description-Content-Type: text/markdown
@@ -3,12 +3,12 @@ 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=0lhO0w_hd5dUdIEJQ2LOJFZsgpzitQU_aPZfTfQK3vw,1302
6
+ glchat_plugin/context/context_manager.py,sha256=AVTs30Tg5EbPb5HDZfW9RI3lY24Pc0-NhOPFxw5XG5U,1330
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
10
  glchat_plugin/pipeline/base_pipeline_preset_config.py,sha256=vr453A2Nx09LqBYbsAVsMutD952wKh3udE1L4vXKyEI,2852
11
- glchat_plugin/pipeline/pipeline_handler.py,sha256=m4FQ3rljVhlQWJWaKomuAQXHRZwWXPGEJbjuXf0_lpQ,28876
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
@@ -16,10 +16,10 @@ glchat_plugin/service/base_tenant_service.py,sha256=CB-jJWXi87nTcjO1XhPoSgNMf2YA
16
16
  glchat_plugin/service/base_user_service.py,sha256=qnRKl2u1xhGc4wMaOd_h_mAuxM7GduyDbqebj-k3GDE,2211
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
- glchat_plugin/storage/base_chat_history_storage.py,sha256=JvUUFMu_9jRBQ9yug_x7S4rQjZEA1vM5ombDvz-7zCE,11095
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.5.dist-info/METADATA,sha256=xurHTPZ1nF4Vewu9iAsqIH5R6YEjROL6wURIwMWoleE,2063
23
- glchat_plugin-0.3.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
- glchat_plugin-0.3.5.dist-info/top_level.txt,sha256=fzKSXmct5dY4CAKku4-mkdHX-QPAyQVvo8vpQj8qizY,14
25
- glchat_plugin-0.3.5.dist-info/RECORD,,
22
+ glchat_plugin-0.3.7.dist-info/METADATA,sha256=g1EufelDxsqC2Zd_wJZv6BuL5acGxs8HTUkjQJiNJK8,2063
23
+ glchat_plugin-0.3.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
+ glchat_plugin-0.3.7.dist-info/top_level.txt,sha256=fzKSXmct5dY4CAKku4-mkdHX-QPAyQVvo8vpQj8qizY,14
25
+ glchat_plugin-0.3.7.dist-info/RECORD,,