using BotSharp.Abstraction.Agents.Models;
using BotSharp.Abstraction.Functions.Models;
using BotSharp.Abstraction.Routing.Enums;
namespace BotSharp.OpenAPI.ViewModels.Agents;
public class AgentCreationModel
{
public string Name { get; set; }
public string Description { get; set; }
public string Type { get; set; } = AgentType.Task;
///
/// Agent routing mode
///
public string? Mode { get; set; }
///
/// LLM default system instructions
///
public string Instruction { get; set; } = string.Empty;
///
///
///
public List ChannelInstructions { get; set; } = new();
///
/// LLM extensible Instructions in addition to the default Instructions
///
public List Templates { get; set; } = new();
///
/// LLM callable function definition
///
public List Functions { get; set; } = new();
///
/// Response template
///
public List Responses { get; set; } = new();
public List Samples { get; set; } = new();
public bool IsPublic { get; set; }
///
/// Whether to allow Router to transfer Request to this Agent
///
public bool AllowRouting { get; set; }
public bool Disabled { get; set; }
///
/// Combine different Agents together to form a Profile.
///
public List Profiles { get; set; } = new();
public List Labels { get; set; } = new();
public bool MergeUtility { get; set; }
public int? MaxMessageCount { get; set; }
public List Utilities { get; set; } = new();
public List McpTools { get; set; } = new();
public List RoutingRules { get; set; } = new();
public List KnowledgeBases { get; set; } = new();
public List Rules { get; set; } = new();
public AgentLlmConfig? LlmConfig { get; set; }
public Agent ToAgent()
{
return new Agent
{
Name = Name,
Type = Type,
Mode = Mode,
Disabled = Disabled,
IsPublic = IsPublic,
Description = Description,
Instruction = Instruction,
ChannelInstructions = ChannelInstructions,
Templates = Templates,
Functions = Functions,
Responses = Responses,
Samples = Samples,
Utilities = Utilities,
McpTools = McpTools,
MergeUtility = MergeUtility,
MaxMessageCount = MaxMessageCount,
Profiles = Profiles,
Labels = Labels,
LlmConfig = LlmConfig ?? new(),
KnowledgeBases = KnowledgeBases,
Rules = Rules,
RoutingRules = RoutingRules?.Select(x => RoutingRuleUpdateModel.ToDomainElement(x))?.ToList() ?? [],
};
}
}