Skip to content

Commit d70a75f

Browse files
committed
refactor(desktop): split backend runtime helpers and cleanup logic
1 parent f63f960 commit d70a75f

9 files changed

Lines changed: 718 additions & 674 deletions

astrbot/core/star/star_manager.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@
4040
logger.warning("未安装 watchfiles,无法实现插件的热重载。")
4141

4242

43+
class PluginDependencyInstallError(Exception):
44+
def __init__(self, plugin_name: str, requirements_path: str, message: str) -> None:
45+
super().__init__(message)
46+
self.plugin_name = plugin_name
47+
self.requirements_path = requirements_path
48+
49+
4350
class PluginManager:
4451
def __init__(self, context: Context, config: AstrBotConfig) -> None:
4552
self.updator = PluginUpdator()
@@ -195,9 +202,11 @@ async def _check_plugin_dept_update(
195202
except Exception as e:
196203
logger.error(f"更新插件 {p} 的依赖失败。Code: {e!s}")
197204
if target_plugin:
198-
raise Exception(
199-
"插件依赖安装失败,请检查插件 requirements.txt "
200-
"中的依赖版本或构建环境。"
205+
raise PluginDependencyInstallError(
206+
plugin_name=p,
207+
requirements_path=pth,
208+
message="插件依赖安装失败,请检查插件 requirements.txt "
209+
"中的依赖版本或构建环境。",
201210
) from e
202211
return True
203212

desktop/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ desktop/resources/backend/
8181
app/ # AstrBot backend source snapshot used in packaged mode
8282
python/ # Bundled CPython runtime directory
8383
launch_backend.py # Launcher executed by Electron
84-
runtime-manifest.json # Runtime metadata (python path, entrypoint, app path)
84+
runtime-manifest.json # Runtime metadata (Python path, entrypoint, app path)
8585
```
8686

8787
Electron reads `runtime-manifest.json` and starts backend with:

0 commit comments

Comments
 (0)