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

Method getChatSystemPrompt

coderd/exp_chats.go:4593–4612  ·  view source on GitHub ↗

nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler.

(rw http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

4591
4592//nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler.
4593func (api *API) getChatSystemPrompt(rw http.ResponseWriter, r *http.Request) {
4594 ctx := r.Context()
4595 if !api.Authorize(r, policy.ActionUpdate, rbac.ResourceDeploymentConfig) {
4596 httpapi.ResourceNotFound(rw)
4597 return
4598 }
4599 config, err := api.Database.GetChatSystemPromptConfig(ctx)
4600 if err != nil {
4601 httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
4602 Message: "Internal error fetching chat system prompt configuration.",
4603 Detail: err.Error(),
4604 })
4605 return
4606 }
4607 httpapi.Write(ctx, rw, http.StatusOK, codersdk.ChatSystemPromptResponse{
4608 SystemPrompt: config.ChatSystemPrompt,
4609 IncludeDefaultSystemPrompt: config.IncludeDefaultSystemPrompt,
4610 DefaultSystemPrompt: chatd.DefaultSystemPrompt,
4611 })
4612}
4613
4614func (api *API) putChatSystemPrompt(rw http.ResponseWriter, r *http.Request) {
4615 ctx := r.Context()

Callers 1

chatSystemPromptFunction · 0.80

Calls 6

AuthorizeMethod · 0.95
ResourceNotFoundFunction · 0.92
WriteFunction · 0.92
ContextMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected