@@ -227,7 +227,11 @@ public async Task<ChatResult> ProcessAsync(Chat chat, bool translate = false)
227227 } ;
228228 }
229229
230- public async Task < ChatResult > ProcessAsync ( string message , bool translate = false , Func < LLMTokenValue , Task > ? callback = null )
230+ public async Task < ChatResult > ProcessAsync (
231+ string message ,
232+ bool translate = false ,
233+ Func < LLMTokenValue , Task > ? tokenCallback = null ,
234+ Func < ToolInvocation , Task > ? toolCallback = null )
231235 {
232236 if ( _knowledge == null )
233237 {
@@ -241,7 +245,7 @@ public async Task<ChatResult> ProcessAsync(string message, bool translate = fals
241245 Type = MessageType . LocalLLM ,
242246 Time = DateTime . Now
243247 } ) ;
244- var result = await _agentService . Process ( chat , _agent . Id , _knowledge , translate , callback ) ;
248+ var result = await _agentService . Process ( chat , _agent . Id , _knowledge , translate , tokenCallback , toolCallback ) ;
245249 var messageResult = result . Messages . LastOrDefault ( ) ! ;
246250 return new ChatResult ( )
247251 {
@@ -252,15 +256,18 @@ public async Task<ChatResult> ProcessAsync(string message, bool translate = fals
252256 } ;
253257 }
254258
255- public async Task < ChatResult > ProcessAsync ( Message message , bool translate = false , Func < LLMTokenValue , Task > ? callback = null )
259+ public async Task < ChatResult > ProcessAsync ( Message message ,
260+ bool translate = false ,
261+ Func < LLMTokenValue , Task > ? tokenCallback = null ,
262+ Func < ToolInvocation , Task > ? toolCallback = null )
256263 {
257264 if ( _knowledge == null )
258265 {
259266 LoadExistingKnowledgeIfExists ( ) ;
260267 }
261268 var chat = await _agentService . GetChatByAgent ( _agent . Id ) ;
262269 chat . Messages . Add ( message ) ;
263- var result = await _agentService . Process ( chat , _agent . Id , _knowledge , translate , callback ) ;
270+ var result = await _agentService . Process ( chat , _agent . Id , _knowledge , translate , tokenCallback , toolCallback ) ; ;
264271 var messageResult = result . Messages . LastOrDefault ( ) ! ;
265272 return new ChatResult ( )
266273 {
@@ -271,7 +278,11 @@ public async Task<ChatResult> ProcessAsync(Message message, bool translate = fal
271278 } ;
272279 }
273280
274- public async Task < ChatResult > ProcessAsync ( IEnumerable < Message > messages , bool translate = false , Func < LLMTokenValue , Task > ? callback = null )
281+ public async Task < ChatResult > ProcessAsync (
282+ IEnumerable < Message > messages ,
283+ bool translate = false ,
284+ Func < LLMTokenValue , Task > ? tokenCallback = null ,
285+ Func < ToolInvocation , Task > ? toolCallback = null )
275286 {
276287 if ( _knowledge == null )
277288 {
@@ -285,7 +296,7 @@ public async Task<ChatResult> ProcessAsync(IEnumerable<Message> messages, bool t
285296 chat . Messages . Add ( systemMsg ) ;
286297 }
287298 chat . Messages . AddRange ( messages ) ;
288- var result = await _agentService . Process ( chat , _agent . Id , _knowledge , translate , callback ) ;
299+ var result = await _agentService . Process ( chat , _agent . Id , _knowledge , translate , tokenCallback , toolCallback ) ; ;
289300 var messageResult = result . Messages . LastOrDefault ( ) ! ;
290301 return new ChatResult ( )
291302 {
0 commit comments