From 4930d1fae7b83952ba8a139ada14b6a5ab2d2d80 Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Fri, 3 Apr 2026 07:12:24 -0700 Subject: [PATCH] feat: add IntegrationConfig for opt-in third-party integrations (#52) --- py/config.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/py/config.py b/py/config.py index bea4b0d4..360b2e2e 100644 --- a/py/config.py +++ b/py/config.py @@ -201,6 +201,39 @@ class GalleryConfig: cls.METADATA_EXTRACTION_TIMEOUT = performance["metadata_extraction_timeout"] +class IntegrationConfig: + """Configuration for third-party extension integrations. + + Manages opt-in integration settings for extensions like LoraManager. + All integrations are disabled by default so PromptManager works standalone. + """ + + # LoraManager integration + LORA_MANAGER_ENABLED = False + LORA_MANAGER_PATH = "" # Auto-detected if empty + LORA_TRIGGER_WORDS_ENABLED = False # Auto-inject trigger words into prompts + + @classmethod + def get_config(cls) -> Dict[str, Any]: + return { + "lora_manager": { + "enabled": cls.LORA_MANAGER_ENABLED, + "path": cls.LORA_MANAGER_PATH, + "trigger_words_enabled": cls.LORA_TRIGGER_WORDS_ENABLED, + }, + } + + @classmethod + def update_config(cls, new_config: Dict[str, Any]): + lora = new_config.get("lora_manager", {}) + if "enabled" in lora: + cls.LORA_MANAGER_ENABLED = lora["enabled"] + if "path" in lora: + cls.LORA_MANAGER_PATH = lora["path"] + if "trigger_words_enabled" in lora: + cls.LORA_TRIGGER_WORDS_ENABLED = lora["trigger_words_enabled"] + + class PromptManagerConfig: """Main configuration class for PromptManager core functionality. @@ -274,6 +307,7 @@ class PromptManagerConfig: "auto_backup_interval": cls.AUTO_BACKUP_INTERVAL, }, "gallery": GalleryConfig.get_config(), + "integrations": IntegrationConfig.get_config(), } @classmethod @@ -389,6 +423,10 @@ class PromptManagerConfig: if "gallery" in new_config: GalleryConfig.update_config(new_config["gallery"]) + # Update integration config + if "integrations" in new_config: + IntegrationConfig.update_config(new_config["integrations"]) + # Load configuration on import try: