MCPcopy Index your code
hub / github.com/coder/coder / resolveUserPrompt

Method resolveUserPrompt

coderd/x/chatd/chatd.go:9216–9227  ·  view source on GitHub ↗

resolveUserPrompt fetches the user's custom chat prompt from the database and wraps it in tags. Returns empty string if no prompt is set.

(ctx context.Context, userID uuid.UUID)

Source from the content-addressed store, hash-verified

9214// database and wraps it in <user-instructions> tags. Returns empty
9215// string if no prompt is set.
9216func (p *Server) resolveUserPrompt(ctx context.Context, userID uuid.UUID) string {
9217 raw, err := p.configCache.UserPrompt(ctx, userID)
9218 if err != nil {
9219 // sql.ErrNoRows is the normal "not set" case.
9220 return ""
9221 }
9222 trimmed := strings.TrimSpace(raw)
9223 if trimmed == "" {
9224 return ""
9225 }
9226 return "<user-instructions>\n" + trimmed + "\n</user-instructions>"
9227}
9228
9229// renderPlanPathPrompt fills the plan-path placeholder when it is
9230// present in the prompt.

Callers 1

runChatMethod · 0.95

Calls 1

UserPromptMethod · 0.80

Tested by

no test coverage detected