fix: prevent duplicate model names

This commit is contained in:
sunanzhi
2025-03-12 14:53:06 +08:00
parent 29da1c441a
commit 3392abaf4b
2 changed files with 10 additions and 8 deletions
+6 -3
View File
@@ -72,10 +72,13 @@ func (i *imlProviderModelService) CheckNameDuplicate(ctx context.Context, provid
v, _ := i.store.First(ctx, map[string]interface{}{"provider": provider, "name": name})
if v == nil {
return false
} else if excludeId != "" && v.UUID != excludeId {
return true
} else {
if excludeId == "" {
return true
} else {
return v.UUID != excludeId
}
}
return false
}
func (i *imlProviderModelService) OnComplete() {