refactor: drop legacy compatibility fallbacks and strictly structure config under 1h-tools

This commit is contained in:
openclaw committed 2026-10-19 03:47:47 +00:00
1 parent 69877803ca
commit ffe71f24b4
6 files changed
+10 -137

No files matched your search

+3 -33
View File
@@ -64,40 +64,10 @@ export function resolveImageConfig(
cfg: ImageGenerationRequest["cfg"] | undefined,
apiPluginConfig?: Record<string, unknown>,
): ImagePluginConfig | undefined {
const toolsConfig = (apiPluginConfig ??
cfg?.plugins?.entries?.["1h-tools"]?.config ??
cfg?.plugins?.entries?.["tools"]?.config) as
| {
image?: ImagePluginConfig;
baseUrl?: string;
apiKey?: string | SecretRefObject;
defaultModel?: string;
models?: string[];
allowPrivateNetwork?: boolean;
}
const config = (apiPluginConfig ?? cfg?.plugins?.entries?.["1h-tools"]?.config) as
| { image?: ImagePluginConfig }
| undefined;
const legacyConfig = (
cfg?.plugins?.entries?.["openai-image"]?.config ??
cfg?.plugins?.entries?.["bifrost-image"]?.config
) as ImagePluginConfig | undefined;
const directImageConfig = toolsConfig?.image;
const flatToolsConfig: ImagePluginConfig | undefined = toolsConfig?.baseUrl
? {
baseUrl: toolsConfig.baseUrl,
apiKey: toolsConfig.apiKey,
allowPrivateNetwork: toolsConfig.allowPrivateNetwork,
defaultModel: toolsConfig.defaultModel,
models: toolsConfig.models,
}
: undefined;
return {
...legacyConfig,
...flatToolsConfig,
...directImageConfig,
};
return config?.image;
}
export function resolveConfiguredImageBaseUrl(