using BotSharp.Abstraction.Agents.Models; using BotSharp.Abstraction.Functions.Models; using BotSharp.Abstraction.Routing.Models; using System.Text.Json.Serialization; namespace BotSharp.OpenAPI.ViewModels.Agents; public class AgentUpdateModel { public string Name { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; /// /// Instruction /// public string Instruction { get; set; } = string.Empty; /// /// Templates /// public List? Templates { get; set; } /// /// Samples /// public List? Samples { get; set; } /// /// Functions /// public List? Functions { get; set; } /// /// Routes /// public List? Responses { get; set; } [JsonPropertyName("is_public")] public bool IsPublic { get; set; } [JsonPropertyName("allow_routing")] public bool AllowRouting { get; set; } public bool Disabled { get; set; } /// /// Profile by channel /// public List? Profiles { get; set; } [JsonPropertyName("routing_rules")] public List? RoutingRules { get; set; } [JsonPropertyName("llm_config")] public AgentLlmConfig? LlmConfig { 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(), LlmConfig = LlmConfig }; return agent; } }