mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 10:21:24 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -34,7 +34,9 @@ export type AgentIdentity = AgentIdentityFile;
|
||||
|
||||
export function listAgentEntries(cfg: OpenClawConfig): AgentEntry[] {
|
||||
const list = cfg.agents?.list;
|
||||
if (!Array.isArray(list)) return [];
|
||||
if (!Array.isArray(list)) {
|
||||
return [];
|
||||
}
|
||||
return list.filter((entry): entry is AgentEntry => Boolean(entry && typeof entry === "object"));
|
||||
}
|
||||
|
||||
@@ -60,11 +62,15 @@ function resolveAgentModel(cfg: OpenClawConfig, agentId: string) {
|
||||
}
|
||||
if (typeof entry.model === "object") {
|
||||
const primary = entry.model.primary?.trim();
|
||||
if (primary) return primary;
|
||||
if (primary) {
|
||||
return primary;
|
||||
}
|
||||
}
|
||||
}
|
||||
const raw = cfg.agents?.defaults?.model;
|
||||
if (typeof raw === "string") return raw;
|
||||
if (typeof raw === "string") {
|
||||
return raw;
|
||||
}
|
||||
return raw?.primary?.trim() || undefined;
|
||||
}
|
||||
|
||||
@@ -74,7 +80,9 @@ export function parseIdentityMarkdown(content: string): AgentIdentity {
|
||||
|
||||
export function loadAgentIdentity(workspace: string): AgentIdentity | null {
|
||||
const parsed = loadAgentIdentityFromWorkspace(workspace);
|
||||
if (!parsed) return null;
|
||||
if (!parsed) {
|
||||
return null;
|
||||
}
|
||||
return identityHasValues(parsed) ? parsed : null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user