Skip to content

Commit 9356cb6

Browse files
authored
Merge pull request #191 from iceljc/features/add-agent-function-impact
Features/add agent function impact
2 parents 209a009 + 4041ca8 commit 9356cb6

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed

src/Infrastructure/BotSharp.Abstraction/Functions/Models/FunctionDef.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ public class FunctionDef
44
{
55
public string Name { get; set; }
66
public string Description { get; set; }
7+
public string? Impact { get; set; }
78
public FunctionParametersDef Parameters { get; set; } = new FunctionParametersDef();
89

910
public override string ToString()

src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ public async Task<List<Conversation>> GetConversations()
5454
public async Task<Conversation> NewConversation(Conversation sess)
5555
{
5656
var db = _services.GetRequiredService<IBotSharpRepository>();
57-
var dbSettings = _services.GetRequiredService<BotSharpDatabaseSettings>();
58-
var conversationSettings = _services.GetRequiredService<ConversationSetting>();
5957
var user = db.GetUserByExternalId(_user.Id);
6058
var foundUserId = user?.Id ?? string.Empty;
6159

src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using BotSharp.Abstraction.Agents.Models;
66
using MongoDB.Driver;
77
using BotSharp.Abstraction.Routing.Models;
8-
using Amazon.Util;
98

109
namespace BotSharp.Core.Repository;
1110

@@ -373,13 +372,7 @@ private void UpdateAgentFunctions(string agentId, List<FunctionDef> inputFunctio
373372
var functionFile = Path.Combine(_dbSettings.FileRepository, _agentSettings.DataDir,
374373
agentId, "functions.json");
375374

376-
var functions = new List<string>();
377-
foreach (var function in inputFunctions)
378-
{
379-
functions.Add(JsonSerializer.Serialize(function, _options));
380-
}
381-
382-
var functionText = JsonSerializer.Serialize(functions, _options);
375+
var functionText = JsonSerializer.Serialize(inputFunctions, _options);
383376
File.WriteAllText(functionFile, functionText);
384377
}
385378

src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentResponseMongoElement.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace BotSharp.Plugin.MongoStorage.Models;
44

5+
[BsonIgnoreExtraElements]
56
public class AgentResponseMongoElement
67
{
78
public string Prefix { get; set; }

src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentTemplateMongoElement.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace BotSharp.Plugin.MongoStorage.Models;
44

5+
[BsonIgnoreExtraElements]
56
public class AgentTemplateMongoElement
67
{
78
public string Name { get; set; }

src/Plugins/BotSharp.Plugin.MongoStorage/Models/FunctionDefMongoElement.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44
namespace BotSharp.Plugin.MongoStorage.Models;
55

6+
[BsonIgnoreExtraElements]
67
public class FunctionDefMongoElement
78
{
89
public string Name { get; set; }
910
public string Description { get; set; }
11+
public string? Impact { get; set; }
1012
public FunctionParametersDefMongoElement Parameters { get; set; } = new FunctionParametersDefMongoElement();
1113

1214
public FunctionDefMongoElement()
@@ -20,6 +22,7 @@ public static FunctionDefMongoElement ToMongoElement(FunctionDef function)
2022
{
2123
Name = function.Name,
2224
Description = function.Description,
25+
Impact = function.Impact,
2326
Parameters = new FunctionParametersDefMongoElement
2427
{
2528
Type = function.Parameters.Type,
@@ -35,6 +38,7 @@ public static FunctionDef ToDomainElement(FunctionDefMongoElement mongoFunction)
3538
{
3639
Name = mongoFunction.Name,
3740
Description = mongoFunction.Description,
41+
Impact = mongoFunction.Impact,
3842
Parameters = new FunctionParametersDef
3943
{
4044
Type = mongoFunction.Parameters.Type,

src/Plugins/BotSharp.Plugin.MongoStorage/Models/RoutingRuleMongoElement.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace BotSharp.Plugin.MongoStorage.Models;
44

5+
[BsonIgnoreExtraElements]
56
public class RoutingRuleMongoElement
67
{
78
public string Field { get; set; }

src/Plugins/BotSharp.Plugin.MongoStorage/Using.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
global using Microsoft.Extensions.Configuration;
1111
global using Microsoft.Extensions.DependencyInjection;
1212
global using MongoDB.Bson;
13-
global using MongoDB.Driver;
13+
global using MongoDB.Driver;
14+
global using MongoDB.Bson.Serialization.Attributes;

0 commit comments

Comments
 (0)