move log setting to conversation

This commit is contained in:
Jicheng Lu 2023-11-29 10:40:27 -06:00
parent 929487c0d6
commit b99a158872
5 changed files with 6 additions and 28 deletions

View file

@ -7,4 +7,6 @@ public class ConversationSetting
public bool EnableKnowledgeBase { get; set; }
public bool ShowVerboseLog { get; set; }
public int MaxRecursiveDepth { get; set; } = 3;
public bool EnableLlmCompletionLog { get; set; }
public bool EnableExecutionLog { get; set; }
}

View file

@ -6,7 +6,6 @@ public class BotSharpDatabaseSettings : DatabaseBasicSettings
public string FileRepository { get; set; }
public string BotSharpMongoDb { get; set; }
public string TablePrefix { get; set; }
public BotSharpLogSetting Log { get; set; }
public DbConnectionSetting BotSharp { get; set; }
}
@ -30,9 +29,3 @@ public class DbConnectionSetting
Slavers = new string[0];
}
}
public class BotSharpLogSetting
{
public bool EnableLlmCompletionLog { get; set; }
public bool EnableExecutionLog { get; set; }
}

View file

@ -817,9 +817,6 @@ public class FileRepository : IBotSharpRepository
#region Execution Log
public void AddExecutionLogs(string conversationId, List<string> logs)
{
var isEnabled = _dbSettings.Log.EnableExecutionLog;
if (!isEnabled) return;
if (string.IsNullOrEmpty(conversationId) || logs.IsNullOrEmpty()) return;
var dir = Path.Combine(_dbSettings.FileRepository, "conversations", conversationId);
@ -849,9 +846,6 @@ public class FileRepository : IBotSharpRepository
#region LLM Completion Log
public void SaveLlmCompletionLog(LlmCompletionLog log)
{
var isEnabled = _dbSettings.Log.EnableLlmCompletionLog;
if (!isEnabled) return;
var convDir = FindConversationDirectory(log.ConversationId);
if (!Directory.Exists(convDir)) return;

View file

@ -4,7 +4,6 @@ using BotSharp.Abstraction.Functions.Models;
using BotSharp.Abstraction.Repositories.Filters;
using BotSharp.Abstraction.Routing.Models;
using BotSharp.Abstraction.Users.Models;
using BotSharp.Abstraction.Utilities;
using BotSharp.Plugin.MongoStorage.Collections;
using BotSharp.Plugin.MongoStorage.Models;
@ -12,14 +11,12 @@ namespace BotSharp.Plugin.MongoStorage.Repository;
public class MongoRepository : IBotSharpRepository
{
private readonly BotSharpDatabaseSettings _dbSettings;
private readonly MongoDbContext _dc;
private readonly IServiceProvider _services;
private UpdateOptions _options;
public MongoRepository(BotSharpDatabaseSettings dbSettings, MongoDbContext dc, IServiceProvider services)
public MongoRepository(MongoDbContext dc, IServiceProvider services)
{
_dbSettings = dbSettings;
_dc = dc;
_services = services;
_options = new UpdateOptions
@ -844,9 +841,6 @@ public class MongoRepository : IBotSharpRepository
#region Execution Log
public void AddExecutionLogs(string conversationId, List<string> logs)
{
var isEnabled = _dbSettings.Log.EnableExecutionLog;
if (!isEnabled) return;
if (string.IsNullOrEmpty(conversationId) || logs.IsNullOrEmpty()) return;
var filter = Builders<ExectionLogCollection>.Filter.Eq(x => x.ConversationId, conversationId);
@ -873,9 +867,6 @@ public class MongoRepository : IBotSharpRepository
#region LLM Completion Log
public void SaveLlmCompletionLog(LlmCompletionLog log)
{
var isEnabled = _dbSettings.Log.EnableLlmCompletionLog;
if (!isEnabled) return;
var completiongLog = new LlmCompletionLogCollection
{
Id = string.IsNullOrEmpty(log.Id) ? Guid.NewGuid().ToString() : log.Id,

View file

@ -34,7 +34,9 @@
"Conversation": {
"DataDir": "conversations",
"ShowVerboseLog": false
"ShowVerboseLog": false,
"EnableLlmCompletionLog": false,
"EnableExecutionLog": true
},
"LlamaSharp": {
@ -104,10 +106,6 @@
"Master": "Data Source=(localdb)\\ProjectModels;Initial Catalog=BotSharp;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False",
"Slavers": []
},
"Log": {
"EnableLlmCompletionLog": false,
"EnableExecutionLog": true
},
"FileRepository": "data",
"UseCamelCase": true,
"Assemblies": [ "BotSharp.Core" ]