| 482 | } |
| 483 | |
| 484 | func (i *imlServiceController) editAIService(ctx *gin.Context, id string, input *service_dto.EditService) (*service_dto.Service, error) { |
| 485 | |
| 486 | if input.Provider == nil { |
| 487 | return nil, fmt.Errorf("provider is required") |
| 488 | } |
| 489 | if *input.Provider != ai_provider_local.ProviderLocal { |
| 490 | _, has := model_runtime.GetProvider(*input.Provider) |
| 491 | if !has { |
| 492 | return nil, fmt.Errorf("provider not found") |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | info, err := i.module.Edit(ctx, id, input) |
| 497 | if err != nil { |
| 498 | return nil, err |
| 499 | } |
| 500 | //_, err = i.upstreamModule.Save(ctx, id, newAIUpstream(id, *input.Provider, p.URI())) |
| 501 | |
| 502 | return info, nil |
| 503 | } |
| 504 | |
| 505 | func (i *imlServiceController) createAIService(ctx *gin.Context, teamID string, input *service_dto.CreateService) (*service_dto.Service, error) { |
| 506 | if input.Provider == nil { |