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

Method putChatComputerUseProvider

coderd/exp_chats.go:5129–5160  ·  view source on GitHub ↗

EXPERIMENTAL: this endpoint is experimental and is subject to change.

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

Source from the content-addressed store, hash-verified

5127
5128// EXPERIMENTAL: this endpoint is experimental and is subject to change.
5129func (api *API) putChatComputerUseProvider(rw http.ResponseWriter, r *http.Request) {
5130 ctx := r.Context()
5131 if !api.Authorize(r, policy.ActionUpdate, rbac.ResourceDeploymentConfig) {
5132 httpapi.Forbidden(rw)
5133 return
5134 }
5135
5136 var req codersdk.UpdateChatComputerUseProviderRequest
5137 if !httpapi.Read(ctx, rw, r, &req) {
5138 return
5139 }
5140 if !chattool.IsSupportedComputerUseProvider(req.Provider) {
5141 httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
5142 Message: "Invalid computer use provider.",
5143 Detail: fmt.Sprintf(
5144 "Expected one of: %s. Got %q.",
5145 strings.Join(chattool.SupportedComputerUseProviders(), ", "),
5146 req.Provider,
5147 ),
5148 })
5149 return
5150 }
5151
5152 if err := api.Database.UpsertChatComputerUseProvider(ctx, req.Provider); err != nil {
5153 httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
5154 Message: "Internal error updating computer use provider.",
5155 Detail: err.Error(),
5156 })
5157 return
5158 }
5159 rw.WriteHeader(http.StatusNoContent)
5160}
5161
5162func (api *API) deploymentChatDebugLoggingEnabled() bool {
5163 return api.DeploymentValues != nil && api.DeploymentValues.AI.Chat.DebugLoggingEnabled.Value()

Callers

nothing calls this directly

Calls 10

AuthorizeMethod · 0.95
ForbiddenFunction · 0.92
ReadFunction · 0.92
WriteFunction · 0.92
ContextMethod · 0.65
ErrorMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected