MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / Disable

Method Disable

module/ai-local/iml.go:478–502  ·  view source on GitHub ↗
(ctx context.Context, model string)

Source from the content-addressed store, hash-verified

476}
477
478func (i *imlLocalModel) Disable(ctx context.Context, model string) error {
479 info, err := i.localModelService.Get(ctx, model)
480 if err != nil {
481 return err
482 }
483 if info.State == ai_local_dto.LocalModelStateNormal.Int() {
484 disable := ai_local_dto.LocalModelStateDisable.Int()
485 return i.transaction.Transaction(ctx, func(ctx context.Context) error {
486 err = i.localModelService.Save(ctx, model, &ai_local.EditLocalModel{State: &disable})
487 if err != nil {
488 return err
489 }
490
491 return i.syncGateway(ctx, cluster.DefaultClusterID, []*gateway.DynamicRelease{
492 {
493 BasicItem: &gateway.BasicItem{
494 ID: info.Id,
495 Resource: "ai-provider",
496 },
497 }}, false)
498 })
499
500 }
501 return fmt.Errorf("model %s is not enabled state,can not disable", model)
502}
503
504func (i *imlLocalModel) OnInit() {
505 register.Handle(func(v server.Server) {

Callers

nothing calls this directly

Calls 4

syncGatewayMethod · 0.95
GetMethod · 0.65
SaveMethod · 0.65
IntMethod · 0.45

Tested by

no test coverage detected