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; }
|
|
|
|
|
|
2023-09-12 22:08:58 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Templates
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<AgentTemplate>? Templates { get; set; }
|
|
|
|
|
|
2023-08-19 00:15:02 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Samples
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string? Samples { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Functions
|
|
|
|
|
/// </summary>
|
2023-09-12 22:08:58 +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-12 22:08:58 +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;
|
|
|
|
|
|
2023-09-12 22:08:58 +00:00
|
|
|
if (!Templates.IsNullOrEmpty())
|
|
|
|
|
agent.Templates = Templates;
|
|
|
|
|
|
2023-08-19 00:15:02 +00:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|