mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-03 01:01:56 +08:00
[Go] Fix to allow duplicate key for provider (#16543)
This commit is contained in:
@@ -116,6 +116,14 @@ func (m *ModelProviderService) AddModelProvider(providerName, userID string) (co
|
||||
|
||||
tenantID := tenants[0].TenantID
|
||||
|
||||
existing, err := m.modelProviderDAO.GetByTenantIDAndProviderName(tenantID, providerName)
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return common.CodeServerError, err
|
||||
}
|
||||
if existing != nil {
|
||||
return common.CodeSuccess, nil
|
||||
}
|
||||
|
||||
providerID := utility.GenerateToken()
|
||||
|
||||
tenantModelProvider := &entity.TenantModelProvider{
|
||||
|
||||
Reference in New Issue
Block a user