File tree Expand file tree Collapse file tree 5 files changed +61
-0
lines changed
BotSharp.Abstraction/Repositories/Filters
BotSharp.Core.SideCar/Services Expand file tree Collapse file tree 5 files changed +61
-0
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change 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+
117using BotSharp . Core . Infrastructures ;
218
319namespace BotSharp . Core . SideCar . Services ;
Original file line number Diff line number Diff line change 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+
117using BotSharp . Abstraction . Conversations . Enums ;
218
319namespace BotSharp . Core . Conversations . Services ;
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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+
117using BotSharp . Abstraction . Infrastructures . Enums ;
218using BotSharp . Abstraction . MLTasks ;
319using BotSharp . Abstraction . Options ;
You can’t perform that action at this time.
0 commit comments