Skip to content

Commit bfdccd7

Browse files
authored
Merge pull request #774 from iceljc/master
add comments
2 parents 7920969 + e831c81 commit bfdccd7

File tree

5 files changed

+61
-0
lines changed

5 files changed

+61
-0
lines changed

src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/RoleFilter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ public static RoleFilter Empty()
1515
{
1616
return new RoleFilter();
1717
}
18+
19+
public bool IsInit()
20+
{
21+
return Names.IsNullOrEmpty();
22+
}
1823
}

src/Infrastructure/BotSharp.Core.SideCar/Services/BotSharpConversationSideCar.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*****************************************************************************
2+
Copyright 2024 Written by Jicheng Lu. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
******************************************************************************/
16+
117
using BotSharp.Core.Infrastructures;
218

319
namespace BotSharp.Core.SideCar.Services;

src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*****************************************************************************
2+
Copyright 2024 Written by Jicheng Lu. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
******************************************************************************/
16+
117
using BotSharp.Abstraction.Conversations.Enums;
218

319
namespace BotSharp.Core.Conversations.Services;

src/Infrastructure/BotSharp.Core/Roles/Services/RoleService.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ public async Task<IEnumerable<string>> GetRoleOptions()
3939
public async Task<IEnumerable<Role>> GetRoles(RoleFilter filter)
4040
{
4141
var db = _services.GetRequiredService<IBotSharpRepository>();
42+
4243
var roles = db.GetRoles(filter);
44+
if (filter.IsInit() && roles.IsNullOrEmpty())
45+
{
46+
await RefreshRoles();
47+
await Task.Delay(100);
48+
roles = db.GetRoles(filter);
49+
}
50+
4351
return roles;
4452
}
4553

src/Infrastructure/BotSharp.Core/Translation/TranslationService.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*****************************************************************************
2+
Copyright 2024 Written by Jicheng Lu. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
******************************************************************************/
16+
117
using BotSharp.Abstraction.Infrastructures.Enums;
218
using BotSharp.Abstraction.MLTasks;
319
using BotSharp.Abstraction.Options;

0 commit comments

Comments
 (0)