Plugins: align reset default agent
This commit is contained in:
parent
a624919c56
commit
f1b9e0fde9
@ -319,12 +319,15 @@ const canonicalizePluginMainSessionAlias = (params: {
|
||||
};
|
||||
|
||||
const resolveDefaultPluginAgentId = (cfg: OpenClawConfig): string => {
|
||||
const agents = Array.isArray(cfg.agents?.list) ? cfg.agents.list : [];
|
||||
const preferred =
|
||||
agents.find((agent) => agent?.default)?.id ??
|
||||
agents.find((agent) => typeof agent?.id === "string")?.id ??
|
||||
FALLBACK_AGENT_ID;
|
||||
return normalizePluginAgentId(preferred);
|
||||
const agents = Array.isArray(cfg.agents?.list)
|
||||
? cfg.agents.list.filter((agent) => Boolean(agent && typeof agent === "object"))
|
||||
: [];
|
||||
if (agents.length === 0) {
|
||||
return FALLBACK_AGENT_ID;
|
||||
}
|
||||
const preferredEntry = agents.find((agent) => agent?.default) ?? agents[0];
|
||||
const preferredId = typeof preferredEntry?.id === "string" ? preferredEntry.id : undefined;
|
||||
return normalizePluginAgentId(preferredId);
|
||||
};
|
||||
|
||||
const resolvePluginMainSessionKey = (cfg: OpenClawConfig): string => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user