( ctx context.Context, r *http.Request, req codersdk.CreateChatRequest, )
| 4425 | } |
| 4426 | |
| 4427 | func (api *API) validateCreateChatWorkspaceSelection( |
| 4428 | ctx context.Context, |
| 4429 | r *http.Request, |
| 4430 | req codersdk.CreateChatRequest, |
| 4431 | ) ( |
| 4432 | createChatWorkspaceSelection, |
| 4433 | int, |
| 4434 | *codersdk.Response, |
| 4435 | ) { |
| 4436 | selection := createChatWorkspaceSelection{} |
| 4437 | workspaceID, workspace, status, resp := api.validateChatWorkspaceSelection(ctx, r, req.WorkspaceID) |
| 4438 | if resp != nil { |
| 4439 | return selection, status, resp |
| 4440 | } |
| 4441 | selection.WorkspaceID = workspaceID |
| 4442 | if !workspaceID.Valid { |
| 4443 | return selection, 0, nil |
| 4444 | } |
| 4445 | if workspace.OrganizationID != req.OrganizationID { |
| 4446 | return selection, http.StatusBadRequest, &codersdk.Response{ |
| 4447 | Message: "Workspace does not belong to the specified organization.", |
| 4448 | } |
| 4449 | } |
| 4450 | |
| 4451 | return selection, 0, nil |
| 4452 | } |
| 4453 | |
| 4454 | func (api *API) resolveCreateChatModelConfigID( |
| 4455 | ctx context.Context, |
no test coverage detected