MCPcopy Index your code
hub / github.com/docker/docker-agent / buildPrompt

Function buildPrompt

pkg/sessiontitle/generator.go:190–199  ·  view source on GitHub ↗

buildPrompt formats the user messages into the system+user message pair sent to the model.

(userMessages []string)

Source from the content-addressed store, hash-verified

188// buildPrompt formats the user messages into the system+user message pair
189// sent to the model.
190func buildPrompt(userMessages []string) []chat.Message {
191 var formatted strings.Builder
192 for i, msg := range userMessages {
193 fmt.Fprintf(&formatted, "%d. %s\n", i+1, msg)
194 }
195 return []chat.Message{
196 {Role: chat.MessageRoleSystem, Content: systemPrompt},
197 {Role: chat.MessageRoleUser, Content: fmt.Sprintf(userPromptFormat, formatted.String())},
198 }
199}
200
201// sanitizeTitle returns the first non-empty trimmed line of title, with any
202// stray carriage returns removed. This guarantees a single-line title safe

Callers 1

GenerateMethod · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected