better:优化部分导入以更快的启动

This commit is contained in:
SengokuCola
2026-04-25 14:26:02 +08:00
parent dcc6748a76
commit 8168fe0d8a
5 changed files with 64 additions and 27 deletions

View File

@@ -279,9 +279,14 @@ class AMemorixHostService:
async with self._lock:
if self._kernel is None:
config = self._read_config()
self._kernel = SDKMemoryKernel(plugin_root=repo_root(), config=config)
await self._kernel.initialize()
set_runtime_kernel(self._kernel)
kernel = SDKMemoryKernel(plugin_root=repo_root(), config=config)
try:
await kernel.initialize()
except Exception:
kernel.close()
raise
self._kernel = kernel
set_runtime_kernel(kernel)
return self._kernel
def _read_config(self) -> Dict[str, Any]: