BotSharp/src/Infrastructure/BotSharp.Abstraction/Routing/Models/RoutingArgs.cs

51 lines
1.4 KiB
C#
Raw Normal View History

2023-08-28 03:50:10 +00:00
namespace BotSharp.Abstraction.Routing.Models;
2023-10-27 15:18:48 +00:00
public class RoutingArgs : ITrackableMessage
{
2023-10-27 15:18:48 +00:00
[JsonPropertyName("message_id")]
public string MessageId { get; set; }
2023-09-26 16:18:42 +00:00
[JsonPropertyName("function")]
2023-10-13 20:08:59 +00:00
public string Function { get; set; }
2023-09-26 16:18:42 +00:00
/// <summary>
/// The reason why you select this function or agent
/// </summary>
2023-09-26 16:18:42 +00:00
[JsonPropertyName("reason")]
public string Reason { get; set; } = string.Empty;
2023-09-26 16:18:42 +00:00
/// <summary>
/// The content of replying to user
/// </summary>
[JsonPropertyName("response")]
public string Response { get; set; }
2023-09-26 16:18:42 +00:00
/// <summary>
/// Agent for next action based on user latest response
/// </summary>
[JsonPropertyName("next_action_agent")]
2023-10-20 03:47:14 +00:00
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string AgentName { get; set; }
/// <summary>
/// Agent who can achieve user original goal
/// </summary>
[JsonPropertyName("user_goal_agent")]
2023-10-20 03:47:14 +00:00
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string OriginalAgent { get; set; }
public override string ToString()
{
2023-09-26 16:18:42 +00:00
var route = string.IsNullOrEmpty(AgentName) ? "" : $"<Route to {AgentName.ToUpper()} because {Reason}>";
if (string.IsNullOrEmpty(Response))
2023-09-26 16:18:42 +00:00
{
return $"[{Function} {route}]";
}
else
{
return $"[{Function} {route}] => {Response}";
2023-09-26 16:18:42 +00:00
}
}
}