MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / buildSystemPrompt

Function buildSystemPrompt

packages/node-runtime/src/ai/agent/prompt-builder.ts:193–221  ·  view source on GitHub ↗
(options: BuildSystemPromptOptions)

Source from the content-addressed store, hash-verified

191}
192
193export function buildSystemPrompt(options: BuildSystemPromptOptions): string {
194 const {
195 t,
196 chatType = 'group',
197 assistantSystemPrompt,
198 ownerInfo,
199 locale = 'zh-CN',
200 skillCtx,
201 mentionedMembers,
202 dataSnapshot,
203 } = options
204
205 const systemPrompt = assistantSystemPrompt || getFallbackRoleDefinition(t, chatType, locale)
206 const lockedSection = getLockedPromptSection(t, chatType, ownerInfo, locale, mentionedMembers, dataSnapshot)
207
208 let skillSection = ''
209 if (skillCtx?.skillDef) {
210 skillSection =
211 `\n## ${agentT(t, 'ai.agent.currentTask', locale)}:${skillCtx.skillDef.name}\n` +
212 `${agentT(t, 'ai.agent.skillPriorityNote', locale)}\n` +
213 skillCtx.skillDef.prompt
214 } else if (skillCtx?.skillMenu) {
215 skillSection = `\n${skillCtx.skillMenu}`
216 }
217
218 return `${systemPrompt}${skillSection}
219
220${lockedSection}`
221}

Callers 2

runServerAgentFunction · 0.90

Calls 3

getLockedPromptSectionFunction · 0.85
agentTFunction · 0.85

Tested by

no test coverage detected