move log setting to conversation
This commit is contained in:
parent
929487c0d6
commit
b99a158872
|
|
@ -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; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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" ]
|
||||
|
|
|
|||
Loading…
Reference in a new issue