diff --git a/config.yaml b/config.yaml index 0d59d25..d8921d3 100644 --- a/config.yaml +++ b/config.yaml @@ -1,7 +1,7 @@ plugin: name: astrbot_plugin_imagestudio display_name: ImageStudio - version: 1.0.0 + version: 1.0.1 features: quick_profile: true diff --git a/frontend/package-lock.json b/frontend/package-lock.json index fc75723..5405ee3 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "astrbot-plugin-imagestudio-frontend", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "astrbot-plugin-imagestudio-frontend", - "version": "1.0.0", + "version": "1.0.1", "dependencies": { "@vitejs/plugin-vue": "^5.2.0", "pinia": "^2.3.0", diff --git a/frontend/package.json b/frontend/package.json index ec317e3..f11fb93 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "astrbot-plugin-imagestudio-frontend", - "version": "1.0.0", + "version": "1.0.1", "private": true, "type": "module", "scripts": { diff --git a/main.py b/main.py index 627e3b3..aad77e5 100644 --- a/main.py +++ b/main.py @@ -23,6 +23,32 @@ if str(PLUGIN_ROOT) not in sys.path: # AstrBot may import the plugin entrypoint without adding the plugin root. sys.path.insert(0, str(PLUGIN_ROOT)) + +def _prepend_plugin_package_path(package_name: str) -> None: + """Let absolute legacy imports resolve inside the plugin package. + + AstrBot itself may already have imported a top-level package named + ``core``. In that case, merely adding the plugin root to ``sys.path`` is + insufficient because Python reuses the existing package from + ``sys.modules``. Prepending our package directory to that package's + search path keeps the host package intact while allowing imports such as + ``core.config_service`` to resolve to ImageStudio's implementation. + """ + + package_dir = PLUGIN_ROOT / package_name + loaded_package = sys.modules.get(package_name) + search_path = getattr(loaded_package, "__path__", None) + if search_path is None or not package_dir.is_dir(): + return + package_path = str(package_dir) + if package_path in search_path: + search_path.remove(package_path) + search_path.insert(0, package_path) + + +for _package_name in ("core", "adapters", "backend", "database", "engines"): + _prepend_plugin_package_path(_package_name) + from adapters.astrbot_adapter import ( dispatch_extension_request, normalize_extension_path, @@ -72,7 +98,7 @@ load_database_settings = _database_db_helper.load_database_settings PLUGIN_NAME = "astrbot_plugin_imagestudio" PLUGIN_DESC = "AstrBot ImageStudio role asset production and image-generation workspace." -PLUGIN_VERSION = "3.1.0" +PLUGIN_VERSION = "1.0.1" BRIDGE_PERMISSIONS = frozenset( {"can_write", "can_manage_config", "can_manage_materials", "can_retry_tasks"} ) diff --git a/metadata.yaml b/metadata.yaml index c2eee7b..bcf5a80 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -2,7 +2,7 @@ name: astrbot_plugin_imagestudio display_name: ImageStudio desc: AstrBot >=4.25 ImageStudio role asset and image-generation workspace for Windows, Linux, macOS and Docker. short_desc: AstrBot 内的角色资产、工作流与图片生成管理工作台。 -version: 1.0.0 +version: 1.0.1 author: YokiiroBW repo: "http://192.168.31.210:18085/YokiiroBW/astrbot_plugin_imagestudio" astrbot_version: ">=4.25.0,<5" diff --git a/release/astrbot_plugin_imagestudio-1.0.1.zip b/release/astrbot_plugin_imagestudio-1.0.1.zip new file mode 100644 index 0000000..aa24d04 Binary files /dev/null and b/release/astrbot_plugin_imagestudio-1.0.1.zip differ