MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / ensureAccountModelsNotBound

Function ensureAccountModelsNotBound

agent/app/service/agents_utils.go:1451–1465  ·  view source on GitHub ↗
(account *model.AgentAccount, models []dto.AgentAccountModel)

Source from the content-addressed store, hash-verified

1449}
1450
1451func ensureAccountModelsNotBound(account *model.AgentAccount, models []dto.AgentAccountModel) error {
1452 if account == nil || account.ID == 0 {
1453 return nil
1454 }
1455 agents, err := agentRepo.List(repo.WithByAccountID(account.ID))
1456 if err != nil {
1457 return err
1458 }
1459 for _, agent := range agents {
1460 if _, ok := findAgentAccountModelForProvider(account.Provider, models, agent.Model); !ok {
1461 return buserr.WithName("ErrAgentModelInUse", agent.Name)
1462 }
1463 }
1464 return nil
1465}
1466
1467func resolveServerTimezone() string {
1468 timezone := strings.TrimSpace(common.LoadTimeZoneByCmd())

Callers 2

UpdateAccountModelMethod · 0.85
DeleteAccountModelMethod · 0.85

Calls 2

ListMethod · 0.65

Tested by

no test coverage detected