fix: update config types
This commit is contained in:
parent
7d03cae66a
commit
d47b4e6f81
@ -338,7 +338,7 @@ export function applySyntheticConfig(cfg: OpenClawConfig): OpenClawConfig {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function applyXiaomiProviderConfig(cfg: MoltbotConfig): MoltbotConfig {
|
export function applyXiaomiProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||||
const models = { ...cfg.agents?.defaults?.models };
|
const models = { ...cfg.agents?.defaults?.models };
|
||||||
models[XIAOMI_DEFAULT_MODEL_REF] = {
|
models[XIAOMI_DEFAULT_MODEL_REF] = {
|
||||||
...models[XIAOMI_DEFAULT_MODEL_REF],
|
...models[XIAOMI_DEFAULT_MODEL_REF],
|
||||||
@ -387,7 +387,7 @@ export function applyXiaomiProviderConfig(cfg: MoltbotConfig): MoltbotConfig {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function applyXiaomiConfig(cfg: MoltbotConfig): MoltbotConfig {
|
export function applyXiaomiConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||||
const next = applyXiaomiProviderConfig(cfg);
|
const next = applyXiaomiProviderConfig(cfg);
|
||||||
const existingModel = next.agents?.defaults?.model;
|
const existingModel = next.agents?.defaults?.model;
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -64,13 +64,13 @@ export const normalizePluginsConfig = (
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const hasExplicitMemorySlot = (plugins?: MoltbotConfig["plugins"]) =>
|
const hasExplicitMemorySlot = (plugins?: OpenClawConfig["plugins"]) =>
|
||||||
Boolean(plugins?.slots && Object.prototype.hasOwnProperty.call(plugins.slots, "memory"));
|
Boolean(plugins?.slots && Object.prototype.hasOwnProperty.call(plugins.slots, "memory"));
|
||||||
|
|
||||||
const hasExplicitMemoryEntry = (plugins?: MoltbotConfig["plugins"]) =>
|
const hasExplicitMemoryEntry = (plugins?: OpenClawConfig["plugins"]) =>
|
||||||
Boolean(plugins?.entries && Object.prototype.hasOwnProperty.call(plugins.entries, "memory-core"));
|
Boolean(plugins?.entries && Object.prototype.hasOwnProperty.call(plugins.entries, "memory-core"));
|
||||||
|
|
||||||
const hasExplicitPluginConfig = (plugins?: MoltbotConfig["plugins"]) => {
|
const hasExplicitPluginConfig = (plugins?: OpenClawConfig["plugins"]) => {
|
||||||
if (!plugins) return false;
|
if (!plugins) return false;
|
||||||
if (typeof plugins.enabled === "boolean") return true;
|
if (typeof plugins.enabled === "boolean") return true;
|
||||||
if (Array.isArray(plugins.allow) && plugins.allow.length > 0) return true;
|
if (Array.isArray(plugins.allow) && plugins.allow.length > 0) return true;
|
||||||
@ -83,9 +83,9 @@ const hasExplicitPluginConfig = (plugins?: MoltbotConfig["plugins"]) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function applyTestPluginDefaults(
|
export function applyTestPluginDefaults(
|
||||||
cfg: MoltbotConfig,
|
cfg: OpenClawConfig,
|
||||||
env: NodeJS.ProcessEnv = process.env,
|
env: NodeJS.ProcessEnv = process.env,
|
||||||
): MoltbotConfig {
|
): OpenClawConfig {
|
||||||
if (!env.VITEST) return cfg;
|
if (!env.VITEST) return cfg;
|
||||||
const plugins = cfg.plugins;
|
const plugins = cfg.plugins;
|
||||||
const explicitConfig = hasExplicitPluginConfig(plugins);
|
const explicitConfig = hasExplicitPluginConfig(plugins);
|
||||||
@ -119,7 +119,7 @@ export function applyTestPluginDefaults(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isTestDefaultMemorySlotDisabled(
|
export function isTestDefaultMemorySlotDisabled(
|
||||||
cfg: MoltbotConfig,
|
cfg: OpenClawConfig,
|
||||||
env: NodeJS.ProcessEnv = process.env,
|
env: NodeJS.ProcessEnv = process.env,
|
||||||
): boolean {
|
): boolean {
|
||||||
if (!env.VITEST) return false;
|
if (!env.VITEST) return false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user