merge with dev

This commit is contained in:
Jicheng Lu 2023-09-04 10:15:11 -05:00
parent a882689e2c
commit f2e0fb0ef7
6 changed files with 18 additions and 1 deletions

View file

@ -33,6 +33,8 @@ public class Agent
/// </summary>
public string Knowledges { get; set; }
public bool IsPublic { get; set; }
public override string ToString()
=> $"{Name} {Id}";

View file

@ -16,6 +16,7 @@ public class AgentRecord : RecordBase
public List<string> Responses { get; set; }
public string Samples { get; set; }
public bool IsPublic { get; set; }
[Required]
public DateTime CreatedTime { get; set; }
@ -32,6 +33,8 @@ public class AgentRecord : RecordBase
Description = agent.Description,
Instruction = agent.Instruction,
Functions = agent.Functions,
Responses = agent.Responses,
IsPublic = agent.IsPublic
};
}
@ -44,6 +47,8 @@ public class AgentRecord : RecordBase
Description = Description,
Instruction = Instruction,
Functions = Functions,
Responses = Responses,
IsPublic = IsPublic,
CreatedDateTime = CreatedTime,
UpdatedDateTime = UpdatedTime
};

View file

@ -9,6 +9,7 @@ public class AgentCreationModel
public string Instruction { get; set; }
public List<string> Functions { get; set; }
public List<string> Responses { get; set; }
public bool IsPublic { get; set; }
public Agent ToAgent()
{
@ -18,7 +19,8 @@ public class AgentCreationModel
Description = Description,
Instruction = Instruction,
Functions = Functions,
Responses = Responses
Responses = Responses,
IsPublic = IsPublic
};
}
}

View file

@ -10,6 +10,7 @@ public class AgentViewModel
public string Instruction { get; set; }
public List<string> Functions { get; set; }
public List<string> Responses { get; set; }
public bool IsPublic { get; set; }
public DateTime UpdatedDateTime { get; set; }
public static AgentViewModel FromAgent(Agent agent)
@ -22,6 +23,7 @@ public class AgentViewModel
Instruction = agent.Instruction,
Functions = agent.Functions,
Responses = agent.Responses,
IsPublic= agent.IsPublic,
UpdatedDateTime = agent.UpdatedDateTime
};
}

View file

@ -7,6 +7,7 @@ public class AgentCollection : MongoBase
public string Instruction { get; set; }
public List<string> Functions { get; set; }
public List<string> Responses { get; set; }
public bool IsPublic { get; set; }
public DateTime CreatedTime { get; set; }
public DateTime UpdatedTime { get; set; }

View file

@ -40,6 +40,7 @@ public class MongoRepository : IBotSharpRepository
Instruction = x.Instruction,
Functions = x.Functions,
Responses = x.Responses,
IsPublic = x.IsPublic,
CreatedTime = x.CreatedTime,
UpdatedTime = x.UpdatedTime
}).ToList();
@ -243,6 +244,7 @@ public class MongoRepository : IBotSharpRepository
Instruction = x.Instruction,
Functions = x.Functions,
Responses = x.Responses,
IsPublic = x.IsPublic,
CreatedTime = x.CreatedTime,
UpdatedTime = x.UpdatedTime
}).ToList();
@ -256,6 +258,7 @@ public class MongoRepository : IBotSharpRepository
.Set(x => x.Instruction, agent.Instruction)
.Set(x => x.Functions, agent.Functions)
.Set(x => x.Responses, agent.Responses)
.Set(x => x.IsPublic, agent.IsPublic)
.Set(x => x.CreatedTime, agent.CreatedTime)
.Set(x => x.UpdatedTime, agent.UpdatedTime);
_dc.Agents.UpdateOne(filter, update, _options);
@ -367,6 +370,7 @@ public class MongoRepository : IBotSharpRepository
Instruction = agent.Instruction,
Functions = agent.Functions,
Responses = agent.Responses,
IsPublic = agent.IsPublic,
UpdatedTime = DateTime.UtcNow
};
@ -378,6 +382,7 @@ public class MongoRepository : IBotSharpRepository
.Set(x => x.Instruction, agent.Instruction)
.Set(x => x.Functions, agent.Functions)
.Set(x => x.Responses, agent.Responses)
.Set(x => x.IsPublic, agent.IsPublic)
.Set(x => x.UpdatedTime, agent.UpdatedTime);
_dc.Agents.UpdateOne(filter, update, _options);