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

55 lines
1.1 KiB
C#
Raw Normal View History

2023-08-19 00:15:02 +00:00
using BotSharp.Abstraction.Agents.Models;
namespace BotSharp.OpenAPI.ViewModels.Agents;
public class AgentUpdateModel
{
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
/// <summary>
/// Instruction
/// </summary>
public string? Instruction { get; set; }
/// <summary>
/// Samples
/// </summary>
public string? Samples { get; set; }
/// <summary>
/// Functions
/// </summary>
2023-09-02 05:10:46 +00:00
public List<string> Functions { get; set; }
2023-08-19 00:15:02 +00:00
2023-08-28 05:28:14 +00:00
/// <summary>
/// Routes
/// </summary>
2023-09-09 21:44:25 +00:00
public List<AgentResponse> Responses { get; set; }
2023-08-28 05:28:14 +00:00
2023-08-19 00:15:02 +00:00
public Agent ToAgent()
{
var agent = new Agent
{
Name = Name
};
if (Description != null)
agent.Description = Description;
if (Instruction != null)
agent.Instruction = Instruction;
if (Samples != null)
agent.Samples = Samples;
2023-09-06 04:41:49 +00:00
if (!Functions.IsNullOrEmpty())
2023-08-19 00:15:02 +00:00
agent.Functions = Functions;
2023-09-06 04:41:49 +00:00
if (!Responses.IsNullOrEmpty())
2023-09-02 05:10:46 +00:00
agent.Responses = Responses;
2023-08-28 05:28:14 +00:00
2023-08-19 00:15:02 +00:00
return agent;
}
}