feat(core): 实现动态提示词模板系统
- 新增 prompt-template 模块,支持运行时变量替换
- 支持 ${variable}、${obj.prop}、${cond ? "a" : "b"} 语法
- AgentInfo 新增 promptTemplate 字段标记动态模板
- Plan Agent 提示词改用模板语法,支持动态工具名和计划文件路径
- AgentExecutor.buildSystemPrompt 集成模板渲染
- 新增 27 个单元测试验证模板功能
This commit is contained in:
@@ -60,3 +60,28 @@ export {
|
||||
|
||||
// System Prompt
|
||||
export { SystemPrompt } from './system-prompt.js';
|
||||
|
||||
// Prompt Template
|
||||
export {
|
||||
renderTemplate,
|
||||
render,
|
||||
createDefaultContext,
|
||||
createPlanContext,
|
||||
checkPlanFileExists,
|
||||
DEFAULT_TOOL_NAMES,
|
||||
generatePlanPrompt,
|
||||
resolveAgentPrompt,
|
||||
PLAN_MODE_TEMPLATE,
|
||||
PLAN_MODE_SUBAGENT_TEMPLATE,
|
||||
PLAN_MODE_REMINDER_TEMPLATE,
|
||||
} from './prompt-template/index.js';
|
||||
|
||||
export type {
|
||||
PromptContext,
|
||||
PromptTemplate,
|
||||
RenderOptions,
|
||||
ToolNameMapping,
|
||||
PlanModeContext,
|
||||
EnvContext,
|
||||
AgentContext,
|
||||
} from './prompt-template/index.js';
|
||||
|
||||
Reference in New Issue
Block a user