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; public string Type { get; set; } = AgentType.Task; /// /// Instruction /// public string Instruction { get; set; } = string.Empty; /// /// Channel instructions /// [JsonPropertyName("channel_instructions")] public List? ChannelInstructions { get; set; } /// /// Templates /// public List? Templates { get; set; } /// /// Samples /// public List? Samples { get; set; } [JsonPropertyName("merge_utility")] public bool MergeUtility { get; set; } /// /// Utilities /// public List? Utilities { get; set; } /// /// McpTools /// public List? McpTools { get; set; } /// /// knowledge bases /// /// [JsonPropertyName("knowledge_bases")] public List? KnowledgeBases { 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; } [JsonPropertyName("max_message_count")] public int? MaxMessageCount { get; set; } /// /// Profile by channel /// public List? Profiles { get; set; } public List? Labels { get; set; } [JsonPropertyName("routing_rules")] public List? RoutingRules { get; set; } [JsonPropertyName("rules")] public List? Rules { 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, MergeUtility = MergeUtility, MaxMessageCount = MaxMessageCount, Type = Type, Profiles = Profiles ?? [], Labels = Labels ?? [], RoutingRules = RoutingRules?.Select(x => RoutingRuleUpdateModel.ToDomainElement(x))?.ToList() ?? [], Instruction = Instruction ?? string.Empty, ChannelInstructions = ChannelInstructions ?? [], Templates = Templates ?? [], Functions = Functions ?? [], Responses = Responses ?? [], Utilities = Utilities ?? [], McpTools = McpTools ?? [], KnowledgeBases = KnowledgeBases ?? [], Rules = Rules ?? [], LlmConfig = LlmConfig ?? new() }; return agent; } }