@@ -226,7 +226,7 @@ public async Task<ChatResult> ProcessAsync(Chat chat, bool translate = false)
226226 } ;
227227 }
228228
229- public async Task < ChatResult > ProcessAsync ( string message , bool translate = false )
229+ public async Task < ChatResult > ProcessAsync ( string message , bool translate = false , Func < LLMTokenValue , Task > ? callback = null )
230230 {
231231 if ( _knowledge == null )
232232 {
@@ -240,7 +240,7 @@ public async Task<ChatResult> ProcessAsync(string message, bool translate = fals
240240 Type = MessageType . LocalLLM ,
241241 Time = DateTime . Now
242242 } ) ;
243- var result = await _agentService . Process ( chat , _agent . Id , _knowledge , translate ) ;
243+ var result = await _agentService . Process ( chat , _agent . Id , _knowledge , translate , callback ) ;
244244 var messageResult = result . Messages . LastOrDefault ( ) ! ;
245245 return new ChatResult ( )
246246 {
@@ -251,15 +251,15 @@ public async Task<ChatResult> ProcessAsync(string message, bool translate = fals
251251 } ;
252252 }
253253
254- public async Task < ChatResult > ProcessAsync ( Message message , bool translate = false )
254+ public async Task < ChatResult > ProcessAsync ( Message message , bool translate = false , Func < LLMTokenValue , Task > ? callback = null )
255255 {
256256 if ( _knowledge == null )
257257 {
258258 LoadExistingKnowledgeIfExists ( ) ;
259259 }
260260 var chat = await _agentService . GetChatByAgent ( _agent . Id ) ;
261261 chat . Messages . Add ( message ) ;
262- var result = await _agentService . Process ( chat , _agent . Id , _knowledge , translate ) ;
262+ var result = await _agentService . Process ( chat , _agent . Id , _knowledge , translate , callback ) ;
263263 var messageResult = result . Messages . LastOrDefault ( ) ! ;
264264 return new ChatResult ( )
265265 {
@@ -270,7 +270,7 @@ public async Task<ChatResult> ProcessAsync(Message message, bool translate = fal
270270 } ;
271271 }
272272
273- public async Task < ChatResult > ProcessAsync ( IEnumerable < Message > messages , bool translate = false )
273+ public async Task < ChatResult > ProcessAsync ( IEnumerable < Message > messages , bool translate = false , Func < LLMTokenValue , Task > ? callback = null )
274274 {
275275 if ( _knowledge == null )
276276 {
@@ -279,7 +279,7 @@ public async Task<ChatResult> ProcessAsync(IEnumerable<Message> messages, bool t
279279 var chat = await _agentService . GetChatByAgent ( _agent . Id ) ;
280280 chat . Messages . Clear ( ) ;
281281 chat . Messages . AddRange ( messages ) ;
282- var result = await _agentService . Process ( chat , _agent . Id , _knowledge , translate ) ;
282+ var result = await _agentService . Process ( chat , _agent . Id , _knowledge , translate , callback ) ;
283283 var messageResult = result . Messages . LastOrDefault ( ) ! ;
284284 return new ChatResult ( )
285285 {
0 commit comments