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; }
|
2023-10-19 22:27:51 +00:00
|
|
|
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-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,
|
2023-10-19 22:27:51 +00:00
|
|
|
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-09-15 20:19:44 +00:00
|
|
|
CreatedDateTime = agent.CreatedDateTime,
|
2023-08-19 00:15:02 +00:00
|
|
|
UpdatedDateTime = agent.UpdatedDateTime
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|