diff --git a/src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/RoleFilter.cs b/src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/RoleFilter.cs index 35e2e1d3..7c6c738a 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/RoleFilter.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/RoleFilter.cs @@ -15,4 +15,9 @@ public class RoleFilter { return new RoleFilter(); } + + public bool IsInit() + { + return Names.IsNullOrEmpty(); + } } diff --git a/src/Infrastructure/BotSharp.Core.SideCar/Services/BotSharpConversationSideCar.cs b/src/Infrastructure/BotSharp.Core.SideCar/Services/BotSharpConversationSideCar.cs index ec3ad0fe..4ddc3a43 100644 --- a/src/Infrastructure/BotSharp.Core.SideCar/Services/BotSharpConversationSideCar.cs +++ b/src/Infrastructure/BotSharp.Core.SideCar/Services/BotSharpConversationSideCar.cs @@ -1,3 +1,19 @@ +/***************************************************************************** + Copyright 2024 Written by Jicheng Lu. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +******************************************************************************/ + using BotSharp.Core.Infrastructures; namespace BotSharp.Core.SideCar.Services; diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs index 152b74ca..eedcdf9a 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs @@ -1,3 +1,19 @@ +/***************************************************************************** + Copyright 2024 Written by Jicheng Lu. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +******************************************************************************/ + using BotSharp.Abstraction.Conversations.Enums; namespace BotSharp.Core.Conversations.Services; diff --git a/src/Infrastructure/BotSharp.Core/Roles/Services/RoleService.cs b/src/Infrastructure/BotSharp.Core/Roles/Services/RoleService.cs index 8cd7935b..9636fe18 100644 --- a/src/Infrastructure/BotSharp.Core/Roles/Services/RoleService.cs +++ b/src/Infrastructure/BotSharp.Core/Roles/Services/RoleService.cs @@ -39,7 +39,15 @@ public class RoleService : IRoleService public async Task> GetRoles(RoleFilter filter) { var db = _services.GetRequiredService(); + var roles = db.GetRoles(filter); + if (filter.IsInit() && roles.IsNullOrEmpty()) + { + await RefreshRoles(); + await Task.Delay(100); + roles = db.GetRoles(filter); + } + return roles; } diff --git a/src/Infrastructure/BotSharp.Core/Translation/TranslationService.cs b/src/Infrastructure/BotSharp.Core/Translation/TranslationService.cs index 453b2277..7b81ac10 100644 --- a/src/Infrastructure/BotSharp.Core/Translation/TranslationService.cs +++ b/src/Infrastructure/BotSharp.Core/Translation/TranslationService.cs @@ -1,3 +1,19 @@ +/***************************************************************************** + Copyright 2024 Written by Jicheng Lu. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +******************************************************************************/ + using BotSharp.Abstraction.Infrastructures.Enums; using BotSharp.Abstraction.MLTasks; using BotSharp.Abstraction.Options;