EXPERIMENTAL: this endpoint is experimental and is subject to change. nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler.
(rw http.ResponseWriter, r *http.Request)
| 4662 | // |
| 4663 | //nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler. |
| 4664 | func (api *API) getChatPlanModeInstructions(rw http.ResponseWriter, r *http.Request) { |
| 4665 | ctx := r.Context() |
| 4666 | if !api.Authorize(r, policy.ActionUpdate, rbac.ResourceDeploymentConfig) { |
| 4667 | httpapi.ResourceNotFound(rw) |
| 4668 | return |
| 4669 | } |
| 4670 | |
| 4671 | instructions, err := api.Database.GetChatPlanModeInstructions(ctx) |
| 4672 | if err != nil { |
| 4673 | httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ |
| 4674 | Message: "Internal error fetching plan mode instructions.", |
| 4675 | Detail: err.Error(), |
| 4676 | }) |
| 4677 | return |
| 4678 | } |
| 4679 | |
| 4680 | httpapi.Write(ctx, rw, http.StatusOK, codersdk.ChatPlanModeInstructionsResponse{ |
| 4681 | PlanModeInstructions: instructions, |
| 4682 | }) |
| 4683 | } |
| 4684 | |
| 4685 | // EXPERIMENTAL: this endpoint is experimental and is subject to change. |
| 4686 | func (api *API) putChatPlanModeInstructions(rw http.ResponseWriter, r *http.Request) { |
no test coverage detected