diff --git a/src/Infrastructure/BotSharp.Abstraction/Functions/Models/FunctionCallFromLlm.cs b/src/Infrastructure/BotSharp.Abstraction/Functions/Models/FunctionCallFromLlm.cs
index 66fdac4e..b0276e15 100644
--- a/src/Infrastructure/BotSharp.Abstraction/Functions/Models/FunctionCallFromLlm.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/Functions/Models/FunctionCallFromLlm.cs
@@ -25,6 +25,12 @@ public class FunctionCallFromLlm : RoutingArgs
[JsonIgnore(Condition = JsonIgnoreCondition.Always)]
public bool UnmatchedAgent { get; set; }
+ ///
+ /// Conversation summary
+ ///
+ [JsonPropertyName("summary")]
+ public string? Summary { get; set; }
+
public override string ToString()
{
var route = string.IsNullOrEmpty(AgentName) ? "" : $"";
diff --git a/src/Infrastructure/BotSharp.Core/Routing/Handlers/HumanInterventionNeededHandler.cs b/src/Infrastructure/BotSharp.Core/Routing/Handlers/HumanInterventionNeededHandler.cs
index b4a4b874..34f1952a 100644
--- a/src/Infrastructure/BotSharp.Core/Routing/Handlers/HumanInterventionNeededHandler.cs
+++ b/src/Infrastructure/BotSharp.Core/Routing/Handlers/HumanInterventionNeededHandler.cs
@@ -1,5 +1,3 @@
-using BotSharp.Abstraction.Functions.Models;
-using BotSharp.Abstraction.Routing;
using BotSharp.Abstraction.Routing.Settings;
namespace BotSharp.Core.Routing.Handlers;
@@ -13,6 +11,7 @@ public class HumanInterventionNeededHandler : RoutingHandlerBase, IRoutingHandle
public List Parameters => new List
{
new ParameterPropertyDef("reason", "why need customer service"),
+ new ParameterPropertyDef("summary", "the whole conversation summary with important information"),
new ParameterPropertyDef("response", "response content to user")
};
diff --git a/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/StreamingLogHook.cs b/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/StreamingLogHook.cs
index dc0ddbb0..303f6dd3 100644
--- a/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/StreamingLogHook.cs
+++ b/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/StreamingLogHook.cs
@@ -68,7 +68,9 @@ public class StreamingLogHook : ConversationHookBase, IContentGeneratingHook, IR
{
var conversationId = _state.GetConversationId();
var agent = await _agentService.LoadAgent(message.CurrentAgentId);
- var log = $"{message.FunctionName}({message.FunctionArgs})\r\n => {message.Content}";
+ message.FunctionArgs = message.FunctionArgs ?? "{}";
+ var args = JsonSerializer.Serialize(JsonDocument.Parse(message.FunctionArgs), _serializerOptions);
+ var log = $"*{message.FunctionName}*\r\n```json\r\n{args}\r\n```\r\n=> {message.Content?.Trim()}";
var input = new ContentLogInputModel(conversationId, message)
{
@@ -123,7 +125,7 @@ public class StreamingLogHook : ConversationHookBase, IContentGeneratingHook, IR
if (message.RichContent != null && message.RichContent.Message.RichType != "text")
{
var richContent = JsonSerializer.Serialize(message.RichContent, _serializerOptions);
- log += $"\r\n{richContent}";
+ log += $"\r\n```json\r\n{richContent}\r\n```";
}
var input = new ContentLogInputModel(conv.ConversationId, message)
@@ -226,6 +228,7 @@ public class StreamingLogHook : ConversationHookBase, IContentGeneratingHook, IR
var conversationId = _state.GetConversationId();
var agent = await _agentService.LoadAgent(message.CurrentAgentId);
var log = JsonSerializer.Serialize(instruct, _serializerOptions);
+ log = $"```json\r\n{log}\r\n```";
var input = new ContentLogInputModel(conversationId, message)
{
diff --git a/tests/BotSharp.Plugin.PizzaBot/Functions/GetPizzaTypesFn.cs b/tests/BotSharp.Plugin.PizzaBot/Functions/GetPizzaTypesFn.cs
index c1694b73..ca348191 100644
--- a/tests/BotSharp.Plugin.PizzaBot/Functions/GetPizzaTypesFn.cs
+++ b/tests/BotSharp.Plugin.PizzaBot/Functions/GetPizzaTypesFn.cs
@@ -4,6 +4,7 @@ using BotSharp.Abstraction.Messaging;
using BotSharp.Abstraction.Messaging.Models.RichContent;
using BotSharp.Abstraction.Messaging.Models.RichContent.Template;
using System.Linq;
+using System.Text.Json;
namespace BotSharp.Plugin.PizzaBot.Functions;
@@ -26,7 +27,7 @@ public class GetPizzaTypesFn : IFunctionCallback
"Cheese Pizza",
"Margherita Pizza"
};
- message.Data = pizzaTypes;
+ message.Content = JsonSerializer.Serialize(pizzaTypes);
message.RichContent = new RichContent
{
Recipient = new Recipient