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)
| 9214 | // database and wraps it in <user-instructions> tags. Returns empty |
| 9215 | // string if no prompt is set. |
| 9216 | func (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. |