MCPcopy Create free account
hub / github.com/astercloud/aster / renderPrompt

Method renderPrompt

pkg/commands/executor.go:83–98  ·  view source on GitHub ↗

renderPrompt 渲染提示词模板

(template string, args map[string]string)

Source from the content-addressed store, hash-verified

81
82// renderPrompt 渲染提示词模板
83func (e *Executor) renderPrompt(template string, args map[string]string) string {
84 result := template
85
86 // 替换占位符
87 for key, value := range args {
88 placeholder := "{" + strings.ToUpper(key) + "}"
89 result = strings.ReplaceAll(result, placeholder, value)
90 }
91
92 // 替换 {SCRIPT} 占位符
93 if e.sandbox != nil {
94 result = strings.ReplaceAll(result, "{SCRIPT}", "script")
95 }
96
97 return result
98}
99
100// buildCommandMessage 构建命令消息
101func (e *Executor) buildCommandMessage(cmd *CommandDefinition, prompt string) string {

Callers 1

ExecuteMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected