glchat-plugin 0.4.0__py3-none-any.whl → 0.4.2__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/pipeline/pipeline_handler.py +16 -10
- {glchat_plugin-0.4.0.dist-info → glchat_plugin-0.4.2.dist-info}/METADATA +1 -1
- {glchat_plugin-0.4.0.dist-info → glchat_plugin-0.4.2.dist-info}/RECORD +5 -5
- {glchat_plugin-0.4.0.dist-info → glchat_plugin-0.4.2.dist-info}/WHEEL +0 -0
- {glchat_plugin-0.4.0.dist-info → glchat_plugin-0.4.2.dist-info}/top_level.txt +0 -0
|
@@ -166,7 +166,7 @@ class PipelineHandler(PluginHandler):
|
|
|
166
166
|
if pipeline_type != instance._chatbot_configs[chatbot_organization_id].pipeline_type:
|
|
167
167
|
continue
|
|
168
168
|
|
|
169
|
-
await cls._build_plugin(instance, chatbot_id, preset.supported_models, plugin)
|
|
169
|
+
await cls._build_plugin(instance, chatbot_id, preset.supported_models, plugin, organization_id)
|
|
170
170
|
except Exception as e:
|
|
171
171
|
logger.warning(f"Failed when ainit pliugin {traceback.format_exc()}")
|
|
172
172
|
logger.warning(f"Error initializing plugin for chatbot `{chatbot_id}`: {e}")
|
|
@@ -186,7 +186,12 @@ class PipelineHandler(PluginHandler):
|
|
|
186
186
|
|
|
187
187
|
@classmethod
|
|
188
188
|
async def _build_plugin(
|
|
189
|
-
cls,
|
|
189
|
+
cls,
|
|
190
|
+
instance: "PipelineHandler",
|
|
191
|
+
chatbot_id: str,
|
|
192
|
+
supported_models: list[dict[str, Any]],
|
|
193
|
+
plugin: Plugin,
|
|
194
|
+
organization_id: str = DEFAULT_ORGANIZATION_ID,
|
|
190
195
|
) -> None:
|
|
191
196
|
"""Build a plugin for the given chatbot.
|
|
192
197
|
|
|
@@ -195,8 +200,8 @@ class PipelineHandler(PluginHandler):
|
|
|
195
200
|
chatbot_id (str): The chatbot ID.
|
|
196
201
|
supported_models (list[dict[str, Any]]): List of models (including config).
|
|
197
202
|
plugin (Plugin): The pipeline builder plugin instance.
|
|
203
|
+
organization_id (str): The organization ID.
|
|
198
204
|
"""
|
|
199
|
-
organization_id = plugin.organization_id
|
|
200
205
|
chatbot_organization_id = (chatbot_id, organization_id)
|
|
201
206
|
plugin.prompt_builder_catalogs = instance._chatbot_configs[chatbot_organization_id].prompt_builder_catalogs
|
|
202
207
|
plugin.lmrp_catalogs = instance._chatbot_configs[chatbot_organization_id].lmrp_catalogs
|
|
@@ -376,7 +381,7 @@ class PipelineHandler(PluginHandler):
|
|
|
376
381
|
return
|
|
377
382
|
|
|
378
383
|
# Use the existing _build_plugin method to rebuild the pipeline
|
|
379
|
-
await __class__._build_plugin(self, chatbot_id, [model_config], plugin)
|
|
384
|
+
await __class__._build_plugin(self, chatbot_id, [model_config], plugin, organization_id)
|
|
380
385
|
|
|
381
386
|
logger.info(f"Successfully rebuilt pipeline for chatbot `{chatbot_organization_id}` model `{model_id}`")
|
|
382
387
|
|
|
@@ -519,7 +524,7 @@ class PipelineHandler(PluginHandler):
|
|
|
519
524
|
)
|
|
520
525
|
|
|
521
526
|
supported_models = list(pipeline_info["config"].get("supported_models", {}).values())
|
|
522
|
-
await __class__._build_plugin(self, chatbot_id, supported_models, plugin)
|
|
527
|
+
await __class__._build_plugin(self, chatbot_id, supported_models, plugin, organization_id)
|
|
523
528
|
|
|
524
529
|
async def delete_chatbot(self, chatbot_id: str, organization_id: str = DEFAULT_ORGANIZATION_ID) -> None:
|
|
525
530
|
"""Delete a chatbot.
|
|
@@ -594,15 +599,16 @@ class PipelineHandler(PluginHandler):
|
|
|
594
599
|
self._builders.pop(chatbot_organization_id, None)
|
|
595
600
|
self._builders[chatbot_organization_id] = plugin
|
|
596
601
|
|
|
597
|
-
await __class__._build_plugin(self, chatbot_id, supported_models, plugin)
|
|
602
|
+
await __class__._build_plugin(self, chatbot_id, supported_models, plugin, organization_id)
|
|
598
603
|
except Exception as e:
|
|
599
604
|
logger.warning(f"Error updating chatbot `{chatbot_id}`: {e}")
|
|
600
605
|
|
|
601
606
|
def _prepare_pipelines(self) -> None:
|
|
602
607
|
"""Build pipeline configurations from the chatbots configuration."""
|
|
603
608
|
pipeline_types: set[tuple[str, str]] = set()
|
|
604
|
-
chatbot_preset_map: dict[str, PipelinePresetConfig] = {}
|
|
609
|
+
chatbot_preset_map: dict[str, dict[str, PipelinePresetConfig]] = {}
|
|
605
610
|
for org_id, org_app_config in self.app_config.items():
|
|
611
|
+
chatbot_preset_map.setdefault(org_id, {})
|
|
606
612
|
for chatbot_id, chatbot_info in org_app_config.chatbots.items():
|
|
607
613
|
if not chatbot_info.pipeline:
|
|
608
614
|
logger.warning(f"Pipeline config not found for chatbot `{chatbot_id}`")
|
|
@@ -611,7 +617,7 @@ class PipelineHandler(PluginHandler):
|
|
|
611
617
|
pipeline_info = chatbot_info.pipeline
|
|
612
618
|
pipeline_type = pipeline_info["type"]
|
|
613
619
|
|
|
614
|
-
chatbot_preset_map[chatbot_id] = PipelinePresetConfig(
|
|
620
|
+
chatbot_preset_map[org_id][chatbot_id] = PipelinePresetConfig(
|
|
615
621
|
preset_id=pipeline_info["config"]["pipeline_preset_id"],
|
|
616
622
|
supported_models=list(pipeline_info["config"].get("supported_models", {}).values()),
|
|
617
623
|
)
|
|
@@ -628,7 +634,7 @@ class PipelineHandler(PluginHandler):
|
|
|
628
634
|
for pipeline_type, org_id in pipeline_types:
|
|
629
635
|
self._activated_configs[(pipeline_type, org_id)] = ChatbotPresetMapping(
|
|
630
636
|
pipeline_type=pipeline_type,
|
|
631
|
-
chatbot_preset_map=chatbot_preset_map,
|
|
637
|
+
chatbot_preset_map=chatbot_preset_map[org_id],
|
|
632
638
|
)
|
|
633
639
|
|
|
634
640
|
def _validate_pipeline(self, chatbot_id: str, organization_id: str) -> None:
|
|
@@ -745,7 +751,7 @@ class PipelineHandler(PluginHandler):
|
|
|
745
751
|
return
|
|
746
752
|
|
|
747
753
|
# Use the existing _build_plugin method to rebuild the plugin
|
|
748
|
-
await __class__._build_plugin(self, chatbot_id, supported_models, plugin)
|
|
754
|
+
await __class__._build_plugin(self, chatbot_id, supported_models, plugin, organization_id)
|
|
749
755
|
|
|
750
756
|
logger.info(f"Successfully rebuilt pipeline builder for chatbot `{chatbot_id}`")
|
|
751
757
|
|
|
@@ -8,7 +8,7 @@ glchat_plugin/handler/__init__.py,sha256=H5DJaAfwwtRsvMcOaEzHfGMQk25H7la0E7uPfks
|
|
|
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=lbMH8y_HU3LrqtMYXLzQ2906ZkMXARKY5vBuIGvRVdA,2969
|
|
11
|
-
glchat_plugin/pipeline/pipeline_handler.py,sha256=
|
|
11
|
+
glchat_plugin/pipeline/pipeline_handler.py,sha256=Kp2LBqtVHzJ2twLaUvYXnL-1QGkqL_8h21IAR7FxBTI,34203
|
|
12
12
|
glchat_plugin/pipeline/pipeline_plugin.py,sha256=eBrg4THS0P49Mz4glEjrwqe1pxnvOn_UitJ9gOBVcac,4562
|
|
13
13
|
glchat_plugin/service/__init__.py,sha256=9T4qzyYL052qLqva5el1F575OTRNaaf9tb9UvW-leTc,47
|
|
14
14
|
glchat_plugin/service/base_rate_limiter_service.py,sha256=tgKwdr4EqnGo5iDRVJPnlg8W9q0hiUzfeewAtdW4IjU,1232
|
|
@@ -19,7 +19,7 @@ glchat_plugin/storage/base_anonymizer_storage.py,sha256=oFwovWrsjM7v1YjeN-4p-M3O
|
|
|
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.4.
|
|
23
|
-
glchat_plugin-0.4.
|
|
24
|
-
glchat_plugin-0.4.
|
|
25
|
-
glchat_plugin-0.4.
|
|
22
|
+
glchat_plugin-0.4.2.dist-info/METADATA,sha256=ESq6bUqzvyNim1Y_FggGMfTXbhQcDoYUbh_jRWBv8-M,2063
|
|
23
|
+
glchat_plugin-0.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
24
|
+
glchat_plugin-0.4.2.dist-info/top_level.txt,sha256=fzKSXmct5dY4CAKku4-mkdHX-QPAyQVvo8vpQj8qizY,14
|
|
25
|
+
glchat_plugin-0.4.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|