From 71336f9ecf555b697f12ae10798721856db4f2c8 Mon Sep 17 00:00:00 2001 From: geffzhang Date: Fri, 28 Mar 2025 09:49:54 +0800 Subject: [PATCH] Update PizzaBotConversationHook.cs --- .../Hooks/PizzaBotConversationHook.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/BotSharp.Plugin.PizzaBot/Hooks/PizzaBotConversationHook.cs b/tests/BotSharp.Plugin.PizzaBot/Hooks/PizzaBotConversationHook.cs index 9b31371f..3ebd4df3 100644 --- a/tests/BotSharp.Plugin.PizzaBot/Hooks/PizzaBotConversationHook.cs +++ b/tests/BotSharp.Plugin.PizzaBot/Hooks/PizzaBotConversationHook.cs @@ -32,18 +32,20 @@ public class PizzaBotConversationHook : ConversationHookBase return base.OnTaskCompleted(message); } + #if USE_BOTSHARP public override async Task OnResponseGenerated(RoleDialogModel message) { var agentService = _services.GetRequiredService(); var state = _services.GetRequiredService(); var agent = await agentService.LoadAgent(message.CurrentAgentId); -#if USE_BOTSHARP + if (agent.McpTools.Any(item => item.Functions.Any(x => x.Name == message.FunctionName))) { var data = JsonDocument.Parse(JsonSerializer.Serialize(message.Data)); state.SaveStateByArgs(data); } -#endif + await base.OnResponseGenerated(message); } + #endif }