diff --git a/src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs b/src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs index 91a89722..ef264659 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs @@ -21,7 +21,7 @@ public class Agent /// Templates /// [JsonIgnore] - public List Templates { get; set; } + public List? Templates { get; set; } /// /// Samples @@ -39,7 +39,7 @@ public class Agent /// Responses /// [JsonIgnore] - public List Responses { get; set; } + public List? Responses { get; set; } /// /// Domain knowledges diff --git a/src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.CreateAgent.cs b/src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.CreateAgent.cs index 69c1c209..ce43e58b 100644 --- a/src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.CreateAgent.cs +++ b/src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.CreateAgent.cs @@ -46,7 +46,7 @@ public partial class AgentService .SetResponses(foundAgent.Responses); } - var user = _db.Users.FirstOrDefault(x => x.ExternalId == _user.Id); + var user = _db.Users.FirstOrDefault(x => x.Id == _user.Id || x.ExternalId == _user.Id); var userAgentRecord = new UserAgent { Id = Guid.NewGuid().ToString(), diff --git a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentCreationModel.cs b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentCreationModel.cs index a6a5ad04..d2a0a7a5 100644 --- a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentCreationModel.cs +++ b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentCreationModel.cs @@ -8,15 +8,40 @@ public class AgentCreationModel { public string Name { get; set; } public string Description { get; set; } - public string Instruction { get; set; } - public List Templates { get; set; } - public List Functions { get; set; } - public List Responses { get; set; } + + /// + /// LLM default system instructions + /// + public string Instruction { get; set; } = string.Empty; + + /// + /// LLM extensible Instructions in addition to the default Instructions + /// + public List? Templates { get; set; } + + /// + /// LLM callable function definition + /// + public List Functions { get; set; } = new List(); + + /// + /// Response template + /// + public List? Responses { get; set; } + 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; } - public List Profiles { get; set; } - public List RoutingRules { get; set; } + + /// + /// Combine different Agents together to form a Profile. + /// + public List Profiles { get; set; } = new List(); + public List RoutingRules { get; set; } = new List(); public Agent ToAgent() { @@ -33,8 +58,8 @@ public class AgentCreationModel Disabled = Disabled, Profiles = Profiles, RoutingRules = RoutingRules? - .Select(x => RoutingRuleUpdateModel.ToDomainElement(x))? - .ToList() ?? new List() + .Select(x => RoutingRuleUpdateModel.ToDomainElement(x))? + .ToList() ?? new List() }; } }