mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 08:47:40 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -17,9 +17,13 @@ function buildSkillsSection(params: {
|
||||
isMinimal: boolean;
|
||||
readToolName: string;
|
||||
}) {
|
||||
if (params.isMinimal) return [];
|
||||
if (params.isMinimal) {
|
||||
return [];
|
||||
}
|
||||
const trimmed = params.skillsPrompt?.trim();
|
||||
if (!trimmed) return [];
|
||||
if (!trimmed) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
"## Skills (mandatory)",
|
||||
"Before replying: scan <available_skills> <description> entries.",
|
||||
@@ -33,7 +37,9 @@ function buildSkillsSection(params: {
|
||||
}
|
||||
|
||||
function buildMemorySection(params: { isMinimal: boolean; availableTools: Set<string> }) {
|
||||
if (params.isMinimal) return [];
|
||||
if (params.isMinimal) {
|
||||
return [];
|
||||
}
|
||||
if (!params.availableTools.has("memory_search") && !params.availableTools.has("memory_get")) {
|
||||
return [];
|
||||
}
|
||||
@@ -45,17 +51,23 @@ function buildMemorySection(params: { isMinimal: boolean; availableTools: Set<st
|
||||
}
|
||||
|
||||
function buildUserIdentitySection(ownerLine: string | undefined, isMinimal: boolean) {
|
||||
if (!ownerLine || isMinimal) return [];
|
||||
if (!ownerLine || isMinimal) {
|
||||
return [];
|
||||
}
|
||||
return ["## User Identity", ownerLine, ""];
|
||||
}
|
||||
|
||||
function buildTimeSection(params: { userTimezone?: string }) {
|
||||
if (!params.userTimezone) return [];
|
||||
if (!params.userTimezone) {
|
||||
return [];
|
||||
}
|
||||
return ["## Current Date & Time", `Time zone: ${params.userTimezone}`, ""];
|
||||
}
|
||||
|
||||
function buildReplyTagsSection(isMinimal: boolean) {
|
||||
if (isMinimal) return [];
|
||||
if (isMinimal) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
"## Reply Tags",
|
||||
"To request a native reply/quote on supported surfaces, include one tag in your reply:",
|
||||
@@ -75,7 +87,9 @@ function buildMessagingSection(params: {
|
||||
runtimeChannel?: string;
|
||||
messageToolHints?: string[];
|
||||
}) {
|
||||
if (params.isMinimal) return [];
|
||||
if (params.isMinimal) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
"## Messaging",
|
||||
"- Reply in current session → automatically routes to the source channel (Signal, Telegram, etc.)",
|
||||
@@ -104,15 +118,21 @@ function buildMessagingSection(params: {
|
||||
}
|
||||
|
||||
function buildVoiceSection(params: { isMinimal: boolean; ttsHint?: string }) {
|
||||
if (params.isMinimal) return [];
|
||||
if (params.isMinimal) {
|
||||
return [];
|
||||
}
|
||||
const hint = params.ttsHint?.trim();
|
||||
if (!hint) return [];
|
||||
if (!hint) {
|
||||
return [];
|
||||
}
|
||||
return ["## Voice (TTS)", hint, ""];
|
||||
}
|
||||
|
||||
function buildDocsSection(params: { docsPath?: string; isMinimal: boolean; readToolName: string }) {
|
||||
const docsPath = params.docsPath?.trim();
|
||||
if (!docsPath || params.isMinimal) return [];
|
||||
if (!docsPath || params.isMinimal) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
"## Documentation",
|
||||
`OpenClaw docs: ${docsPath}`,
|
||||
@@ -252,7 +272,9 @@ export function buildAgentSystemPrompt(params: {
|
||||
const externalToolSummaries = new Map<string, string>();
|
||||
for (const [key, value] of Object.entries(params.toolSummaries ?? {})) {
|
||||
const normalized = key.trim().toLowerCase();
|
||||
if (!normalized || !value?.trim()) continue;
|
||||
if (!normalized || !value?.trim()) {
|
||||
continue;
|
||||
}
|
||||
externalToolSummaries.set(normalized, value.trim());
|
||||
}
|
||||
const extraTools = Array.from(
|
||||
|
||||
Reference in New Issue
Block a user