add missing field
This commit is contained in:
parent
fa769227e0
commit
d50ef81f3e
|
|
@ -75,7 +75,7 @@ public class Agent
|
|||
/// Default is True, user will enable this by installing appropriate plugin.
|
||||
/// </summary>
|
||||
public bool Disabled { get; set; } = true;
|
||||
public string IconUrl { get; set; }
|
||||
public string? IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Profile by channel
|
||||
|
|
|
|||
|
|
@ -13,7 +13,10 @@ public partial class AgentService
|
|||
if (!isDeleted) return;
|
||||
|
||||
var dbSettings = _services.GetRequiredService<BotSharpDatabaseSettings>();
|
||||
var agentDir = Path.Combine(dbSettings.FileRepository, _agentSettings.DataDir);
|
||||
var agentDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
|
||||
dbSettings.FileRepository,
|
||||
_agentSettings.DataDir);
|
||||
|
||||
var user = _db.GetUserById(_user.Id);
|
||||
var agents = new List<Agent>();
|
||||
var userAgents = new List<UserAgent>();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public partial class AgentService
|
|||
record.Templates = agent.Templates ?? new List<AgentTemplate>();
|
||||
record.Responses = agent.Responses ?? new List<AgentResponse>();
|
||||
record.Samples = agent.Samples ?? new List<string>();
|
||||
if (!agent.LlmConfig.IsInherit)
|
||||
if (agent.LlmConfig != null && !agent.LlmConfig.IsInherit)
|
||||
{
|
||||
record.LlmConfig = agent.LlmConfig;
|
||||
}
|
||||
|
|
@ -47,7 +47,9 @@ public partial class AgentService
|
|||
|
||||
var dbSettings = _services.GetRequiredService<BotSharpDatabaseSettings>();
|
||||
var agentSettings = _services.GetRequiredService<AgentSettings>();
|
||||
var filePath = Path.Combine(dbSettings.FileRepository, agentSettings.DataDir);
|
||||
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
|
||||
dbSettings.FileRepository,
|
||||
agentSettings.DataDir);
|
||||
|
||||
var clonedAgent = Agent.Clone(agent);
|
||||
var foundAgent = FetchAgentFileById(agent.Id, filePath);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ public class AgentDocument : MongoBase
|
|||
{
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string? IconUrl { get; set; }
|
||||
public string Instruction { get; set; }
|
||||
public List<AgentTemplateMongoElement> Templates { get; set; }
|
||||
public List<FunctionDefMongoElement> Functions { get; set; }
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ public class AgentLlmConfigMongoElement
|
|||
{
|
||||
public string? Provider { get; set; }
|
||||
public string? Model { get; set; }
|
||||
public bool IsInherit { get; set; }
|
||||
|
||||
public static AgentLlmConfigMongoElement? ToMongoElement(AgentLlmConfig? config)
|
||||
{
|
||||
|
|
@ -14,7 +15,8 @@ public class AgentLlmConfigMongoElement
|
|||
return new AgentLlmConfigMongoElement
|
||||
{
|
||||
Provider = config.Provider,
|
||||
Model = config.Model
|
||||
Model = config.Model,
|
||||
IsInherit = config.IsInherit,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -25,7 +27,8 @@ public class AgentLlmConfigMongoElement
|
|||
return new AgentLlmConfig
|
||||
{
|
||||
Provider = config.Provider,
|
||||
Model = config.Model
|
||||
Model = config.Model,
|
||||
IsInherit = config.IsInherit,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,6 +252,7 @@ public partial class MongoRepository
|
|||
{
|
||||
Id = agent.Id,
|
||||
Name = agent.Name,
|
||||
IconUrl = agent.IconUrl,
|
||||
Description = agent.Description,
|
||||
Instruction = agent.Instruction,
|
||||
Templates = !agent.Templates.IsNullOrEmpty() ? agent.Templates
|
||||
|
|
@ -338,6 +339,7 @@ public partial class MongoRepository
|
|||
{
|
||||
Id = x.Id,
|
||||
Name = x.Name,
|
||||
IconUrl = x.IconUrl,
|
||||
Description = x.Description,
|
||||
Instruction = x.Instruction,
|
||||
Templates = !x.Templates.IsNullOrEmpty() ? x.Templates
|
||||
|
|
@ -402,6 +404,7 @@ public partial class MongoRepository
|
|||
{
|
||||
Id = !string.IsNullOrEmpty(x.Id) ? x.Id : Guid.NewGuid().ToString(),
|
||||
Name = x.Name,
|
||||
IconUrl = x.IconUrl,
|
||||
Description = x.Description,
|
||||
Instruction = x.Instruction,
|
||||
Templates = x.Templates?
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public partial class MongoRepository
|
|||
Name = x.Name,
|
||||
Description = x.Description,
|
||||
Instruction = x.Instruction,
|
||||
IconUrl = x.IconUrl,
|
||||
Templates = x.Templates?
|
||||
.Select(t => AgentTemplateMongoElement.ToMongoElement(t))?
|
||||
.ToList() ?? new List<AgentTemplateMongoElement>(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue