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

Method getChatPersonalModelOverridesAdminSettings

coderd/exp_chats.go:4858–4876  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

4856//
4857//nolint:revive // get-return: revive assumes get* must be a getter, but this is an HTTP handler.
4858func (api *API) getChatPersonalModelOverridesAdminSettings(rw http.ResponseWriter, r *http.Request) {
4859 ctx := r.Context()
4860 if !api.Authorize(r, policy.ActionRead, rbac.ResourceDeploymentConfig) {
4861 httpapi.ResourceNotFound(rw)
4862 return
4863 }
4864
4865 enabled, err := api.Database.GetChatPersonalModelOverridesEnabled(ctx)
4866 if err != nil {
4867 httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
4868 Message: "Internal error fetching personal model override setting.",
4869 Detail: err.Error(),
4870 })
4871 return
4872 }
4873 httpapi.Write(ctx, rw, http.StatusOK, codersdk.ChatPersonalModelOverridesAdminSettings{
4874 AllowUsers: enabled,
4875 })
4876}
4877
4878// EXPERIMENTAL: this endpoint is experimental and is subject to change.
4879func (api *API) putChatPersonalModelOverridesAdminSettings(rw http.ResponseWriter, r *http.Request) {

Calls 6

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

Tested by

no test coverage detected