using BotSharp.Abstraction.Agents.Models;
using BotSharp.Abstraction.Functions.Models;
using BotSharp.Abstraction.Routing.Models;
namespace BotSharp.OpenAPI.ViewModels.Agents;
public class AgentUpdateModel
{
public string? Name { get; set; } = string.Empty;
public string? Description { get; set; }
///
/// Instruction
///
public string? Instruction { get; set; }
///
/// Templates
///
public List? Templates { get; set; }
///
/// Samples
///
public string? Samples { get; set; }
///
/// Functions
///
public List? Functions { get; set; }
///
/// Routes
///
public List? Responses { get; set; }
public bool IsPublic { get; set; }
public bool AllowRouting { get; set; }
public bool Disabled { get; set; }
///
/// Profile by channel
///
public List? Profiles { get; set; }
public List? RoutingRules { get; set; }
public Agent ToAgent()
{
var agent = new Agent()
{
Name = Name ?? string.Empty,
Description = Description ?? string.Empty,
IsPublic = IsPublic,
Disabled = Disabled,
AllowRouting = AllowRouting,
Profiles = Profiles ?? new List(),
RoutingRules = RoutingRules?
.Select(x => RoutingRuleUpdateModel.ToDomainElement(x))?
.ToList() ?? new List(),
Instruction = Instruction ?? string.Empty,
Templates = Templates ?? new List(),
Functions = Functions ?? new List(),
Responses = Responses ?? new List()
};
return agent;
}
}