BotSharp/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentViewModel.cs

62 lines
2.1 KiB
C#
Raw Normal View History

2023-08-19 00:15:02 +00:00
using BotSharp.Abstraction.Agents.Models;
2023-09-27 20:49:44 +00:00
using BotSharp.Abstraction.Functions.Models;
2023-09-19 18:18:29 +00:00
using BotSharp.Abstraction.Routing.Models;
2023-11-27 21:00:26 +00:00
using System.Text.Json.Serialization;
2023-08-19 00:15:02 +00:00
namespace BotSharp.OpenAPI.ViewModels.Agents;
public class AgentViewModel
{
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
2023-08-28 05:36:11 +00:00
public string Instruction { get; set; }
2023-09-12 22:08:58 +00:00
public List<AgentTemplate> Templates { get; set; }
2023-09-27 20:49:44 +00:00
public List<FunctionDef> Functions { get; set; }
2023-09-09 21:44:25 +00:00
public List<AgentResponse> Responses { get; set; }
public List<string> Samples { get; set; }
2023-09-04 15:15:11 +00:00
public bool IsPublic { get; set; }
2023-11-27 21:00:26 +00:00
[JsonPropertyName("allow_routing")]
2023-09-19 18:18:29 +00:00
public bool AllowRouting { get; set; }
public bool Disabled { get; set; }
public List<string> Profiles { get; set; }
2023-11-27 21:00:26 +00:00
[JsonPropertyName("routing_rules")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
2023-09-19 18:18:29 +00:00
public List<RoutingRule> RoutingRules { get; set; }
2023-12-24 19:57:22 +00:00
[JsonPropertyName("llm_config")]
2023-12-13 20:26:46 +00:00
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public AgentLlmConfig? LlmConfig { get; set; }
2023-11-27 21:00:26 +00:00
[JsonPropertyName("created_datetime")]
2023-09-15 20:19:44 +00:00
public DateTime CreatedDateTime { get; set; }
2023-11-27 21:00:26 +00:00
[JsonPropertyName("updated_datetime")]
2023-08-19 00:15:02 +00:00
public DateTime UpdatedDateTime { get; set; }
public static AgentViewModel FromAgent(Agent agent)
{
return new AgentViewModel
{
Id = agent.Id,
Name = agent.Name,
Description = agent.Description,
2023-08-28 05:36:11 +00:00
Instruction = agent.Instruction,
2023-09-12 22:08:58 +00:00
Templates = agent.Templates,
2023-08-28 05:36:11 +00:00
Functions = agent.Functions,
2023-09-02 05:10:46 +00:00
Responses = agent.Responses,
Samples = agent.Samples,
2023-09-04 15:15:11 +00:00
IsPublic= agent.IsPublic,
2023-09-19 18:18:29 +00:00
Disabled = agent.Disabled,
AllowRouting = agent.AllowRouting,
Profiles = agent.Profiles,
RoutingRules = agent.RoutingRules,
2023-12-13 20:26:46 +00:00
LlmConfig = agent.LlmConfig,
2023-09-15 20:19:44 +00:00
CreatedDateTime = agent.CreatedDateTime,
2023-08-19 00:15:02 +00:00
UpdatedDateTime = agent.UpdatedDateTime
};
}
}