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()
15
15
{
16
16
return new RoleFilter ( ) ;
17
17
}
18
+
19
+ public bool IsInit ( )
20
+ {
21
+ return Names . IsNullOrEmpty ( ) ;
22
+ }
18
23
}
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
+
1
17
using BotSharp . Core . Infrastructures ;
2
18
3
19
namespace 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
+
1
17
using BotSharp . Abstraction . Conversations . Enums ;
2
18
3
19
namespace BotSharp . Core . Conversations . Services ;
Original file line number Diff line number Diff line change @@ -39,7 +39,15 @@ public async Task<IEnumerable<string>> GetRoleOptions()
39
39
public async Task < IEnumerable < Role > > GetRoles ( RoleFilter filter )
40
40
{
41
41
var db = _services . GetRequiredService < IBotSharpRepository > ( ) ;
42
+
42
43
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
+
43
51
return roles ;
44
52
}
45
53
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
+
1
17
using BotSharp . Abstraction . Infrastructures . Enums ;
2
18
using BotSharp . Abstraction . MLTasks ;
3
19
using BotSharp . Abstraction . Options ;
You can’t perform that action at this time.
0 commit comments