mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 03:00:21 +00:00
fix(runtime): stabilize image generation auth/runtime loading
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { resolveStateDir } from "../../config/paths.js";
|
||||
import { loadBundledPluginPublicSurfaceModuleSync } from "../../plugin-sdk/facade-runtime.js";
|
||||
import { resolveGlobalSingleton } from "../../shared/global-singleton.js";
|
||||
import {
|
||||
createLazyRuntimeMethod,
|
||||
@@ -7,7 +8,6 @@ import {
|
||||
} from "../../shared/lazy-runtime.js";
|
||||
import { VERSION } from "../../version.js";
|
||||
import { listWebSearchProviders, runWebSearch } from "../../web-search/runtime.js";
|
||||
import { loadSiblingRuntimeModuleSync } from "./local-runtime-module.js";
|
||||
import { createRuntimeAgent } from "./runtime-agent.js";
|
||||
import { defineCachedValue } from "./runtime-cache.js";
|
||||
import { createRuntimeChannel } from "./runtime-channel.js";
|
||||
@@ -50,16 +50,18 @@ function createRuntimeMediaUnderstandingFacade(): PluginRuntime["mediaUnderstand
|
||||
};
|
||||
}
|
||||
|
||||
type RuntimeImageGenerationModule = typeof import("./runtime-image-generation.runtime.js");
|
||||
type RuntimeImageGenerationModule = Pick<
|
||||
typeof import("../../plugin-sdk/image-generation-runtime.js"),
|
||||
"generateImage" | "listRuntimeImageGenerationProviders"
|
||||
>;
|
||||
let cachedRuntimeImageGenerationModule: RuntimeImageGenerationModule | null = null;
|
||||
|
||||
function loadRuntimeImageGenerationModule(): RuntimeImageGenerationModule {
|
||||
cachedRuntimeImageGenerationModule ??= loadSiblingRuntimeModuleSync<RuntimeImageGenerationModule>(
|
||||
{
|
||||
moduleUrl: import.meta.url,
|
||||
relativeBase: "./runtime-image-generation.runtime",
|
||||
},
|
||||
);
|
||||
cachedRuntimeImageGenerationModule ??=
|
||||
loadBundledPluginPublicSurfaceModuleSync<RuntimeImageGenerationModule>({
|
||||
dirName: "image-generation-core",
|
||||
artifactBasename: "runtime-api.js",
|
||||
});
|
||||
return cachedRuntimeImageGenerationModule;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user