@@ -32,12 +32,11 @@ public PlatformBuilderBase(IAgentStorageFactory<TAgent> agentStorageFactory, IPl
3232 {
3333 this . agentStorageFactory = agentStorageFactory ;
3434 this . settings = settings ;
35+ GetAgentStorage ( ) ;
3536 }
3637
3738 public async Task < List < TAgent > > GetAllAgents ( )
3839 {
39- await GetStorage ( ) ;
40-
4140 return await Storage . Query ( ) ;
4241 }
4342
@@ -80,15 +79,11 @@ private AgentImportHeader LoadMeta(string dataDir)
8079
8180 public async Task < TAgent > GetAgentById ( string agentId )
8281 {
83- GetStorage ( ) ;
84-
8582 return await Storage . FetchById ( agentId ) ;
8683 }
8784
8885 public async Task < TAgent > GetAgentByName ( string agentName )
8986 {
90- await GetStorage ( ) ;
91-
9287 return await Storage . FetchByName ( agentName ) ;
9388 }
9489
@@ -195,7 +190,7 @@ public virtual async Task<TResult> TextRequest<TResult>(AiRequest request)
195190
196191 Console . WriteLine ( $ "TextResponse: { aiResponse . Intent } , { request . SessionId } ") ;
197192
198- return await AssembleResult < TResult > ( aiResponse ) ;
193+ return await AssembleResult < TResult > ( request , aiResponse ) ;
199194 }
200195
201196 public virtual async Task < TextClassificationResult > FallbackResponse ( AiRequest request )
@@ -222,27 +217,25 @@ public virtual async Task<TextClassificationResult> FallbackResponse(AiRequest r
222217 }
223218 }
224219
225- public virtual async Task < TResult > AssembleResult < TResult > ( AiResponse response )
220+ public virtual async Task < TResult > AssembleResult < TResult > ( AiRequest request , AiResponse response )
226221 {
227222 throw new NotImplementedException ( ) ;
228223 }
229224
230225 public virtual async Task < bool > SaveAgent ( TAgent agent )
231226 {
232- await GetStorage ( ) ;
233-
234227 // default save agent in FileStorage
235228 await Storage . Persist ( agent ) ;
236229
237230 return true ;
238231 }
239-
240- protected async Task < IAgentStorage < TAgent > > GetStorage ( )
232+ protected IAgentStorage < TAgent > GetAgentStorage ( )
241233 {
242234 if ( Storage == null )
243235 {
244- Storage = await agentStorageFactory . Get ( ) ;
236+ Storage = agentStorageFactory . Get ( ) ;
245237 }
238+
246239 return Storage ;
247240 }
248241 }
0 commit comments