Merge pull request #191 from iceljc/features/add-agent-function-impact
Features/add agent function impact
This commit is contained in:
commit
9356cb6262
|
|
@ -4,6 +4,7 @@ public class FunctionDef
|
|||
{
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string? Impact { get; set; }
|
||||
public FunctionParametersDef Parameters { get; set; } = new FunctionParametersDef();
|
||||
|
||||
public override string ToString()
|
||||
|
|
|
|||
|
|
@ -54,8 +54,6 @@ public partial class ConversationService : IConversationService
|
|||
public async Task<Conversation> NewConversation(Conversation sess)
|
||||
{
|
||||
var db = _services.GetRequiredService<IBotSharpRepository>();
|
||||
var dbSettings = _services.GetRequiredService<BotSharpDatabaseSettings>();
|
||||
var conversationSettings = _services.GetRequiredService<ConversationSetting>();
|
||||
var user = db.GetUserByExternalId(_user.Id);
|
||||
var foundUserId = user?.Id ?? string.Empty;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ using BotSharp.Abstraction.Users.Models;
|
|||
using BotSharp.Abstraction.Agents.Models;
|
||||
using MongoDB.Driver;
|
||||
using BotSharp.Abstraction.Routing.Models;
|
||||
using Amazon.Util;
|
||||
|
||||
namespace BotSharp.Core.Repository;
|
||||
|
||||
|
|
@ -373,13 +372,7 @@ public class FileRepository : IBotSharpRepository
|
|||
var functionFile = Path.Combine(_dbSettings.FileRepository, _agentSettings.DataDir,
|
||||
agentId, "functions.json");
|
||||
|
||||
var functions = new List<string>();
|
||||
foreach (var function in inputFunctions)
|
||||
{
|
||||
functions.Add(JsonSerializer.Serialize(function, _options));
|
||||
}
|
||||
|
||||
var functionText = JsonSerializer.Serialize(functions, _options);
|
||||
var functionText = JsonSerializer.Serialize(inputFunctions, _options);
|
||||
File.WriteAllText(functionFile, functionText);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using BotSharp.Abstraction.Agents.Models;
|
|||
|
||||
namespace BotSharp.Plugin.MongoStorage.Models;
|
||||
|
||||
[BsonIgnoreExtraElements]
|
||||
public class AgentResponseMongoElement
|
||||
{
|
||||
public string Prefix { get; set; }
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using BotSharp.Abstraction.Agents.Models;
|
|||
|
||||
namespace BotSharp.Plugin.MongoStorage.Models;
|
||||
|
||||
[BsonIgnoreExtraElements]
|
||||
public class AgentTemplateMongoElement
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
|
|
|||
|
|
@ -3,10 +3,12 @@ using System.Text.Json;
|
|||
|
||||
namespace BotSharp.Plugin.MongoStorage.Models;
|
||||
|
||||
[BsonIgnoreExtraElements]
|
||||
public class FunctionDefMongoElement
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string? Impact { get; set; }
|
||||
public FunctionParametersDefMongoElement Parameters { get; set; } = new FunctionParametersDefMongoElement();
|
||||
|
||||
public FunctionDefMongoElement()
|
||||
|
|
@ -20,6 +22,7 @@ public class FunctionDefMongoElement
|
|||
{
|
||||
Name = function.Name,
|
||||
Description = function.Description,
|
||||
Impact = function.Impact,
|
||||
Parameters = new FunctionParametersDefMongoElement
|
||||
{
|
||||
Type = function.Parameters.Type,
|
||||
|
|
@ -35,6 +38,7 @@ public class FunctionDefMongoElement
|
|||
{
|
||||
Name = mongoFunction.Name,
|
||||
Description = mongoFunction.Description,
|
||||
Impact = mongoFunction.Impact,
|
||||
Parameters = new FunctionParametersDef
|
||||
{
|
||||
Type = mongoFunction.Parameters.Type,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using BotSharp.Abstraction.Routing.Models;
|
|||
|
||||
namespace BotSharp.Plugin.MongoStorage.Models;
|
||||
|
||||
[BsonIgnoreExtraElements]
|
||||
public class RoutingRuleMongoElement
|
||||
{
|
||||
public string Field { get; set; }
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@ global using BotSharp.Abstraction.Plugins;
|
|||
global using Microsoft.Extensions.Configuration;
|
||||
global using Microsoft.Extensions.DependencyInjection;
|
||||
global using MongoDB.Bson;
|
||||
global using MongoDB.Driver;
|
||||
global using MongoDB.Driver;
|
||||
global using MongoDB.Bson.Serialization.Attributes;
|
||||
Loading…
Reference in a new issue