diff --git a/Directory.Build.props b/Directory.Build.props
index 4233fb32..6716a3c7 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -2,7 +2,7 @@
net8.0
12.0
- 3.0.0
+ 4.0.0
true
false
diff --git a/README.md b/README.md
index e5c3684a..9fd42e2a 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ It's written in C# running on .Net Core that is full cross-platform framework, t
* Built-in multi-agents and conversation with state management.
* Support multiple LLM Planning approaches to handle different tasks from simple to complex.
* Built-in RAG related interfaces, Memory based vector searching.
-* Support multiple AI platforms (ChatGPT 3.5 / 4.0, PaLM 2, LLaMA 3, Claude Sonnet 3.5, HuggingFace).
+* Support multiple AI platforms (ChatGPT 3.5/ 4o/ o1, Gemini 2, LLaMA 3, Claude Sonnet 3.5, HuggingFace).
* Allow multiple agents with different responsibilities cooperate to complete complex tasks.
* Build, test, evaluate and audit your LLM agent in one place.
* Build-in `BotSharp UI` written in [SvelteKit](https://kit.svelte.dev/).
diff --git a/src/Infrastructure/BotSharp.Core/BotSharpCoreExtensions.cs b/src/Infrastructure/BotSharp.Core/BotSharpCoreExtensions.cs
index af8a9324..f588b4d1 100644
--- a/src/Infrastructure/BotSharp.Core/BotSharpCoreExtensions.cs
+++ b/src/Infrastructure/BotSharp.Core/BotSharpCoreExtensions.cs
@@ -105,6 +105,11 @@ public static class BotSharpCoreExtensions
var dbSettings = new BotSharpDatabaseSettings();
config.Bind("Database", dbSettings);
+ if (string.IsNullOrEmpty(dbSettings.Redis))
+ {
+ return;
+ }
+
services.AddSingleton(ConnectionMultiplexer.Connect(dbSettings.Redis));
services.AddSingleton();
services.AddSingleton();
diff --git a/src/Infrastructure/BotSharp.Core/Infrastructures/DistributedLocker.cs b/src/Infrastructure/BotSharp.Core/Infrastructures/DistributedLocker.cs
index 48ff193f..c87dbe45 100644
--- a/src/Infrastructure/BotSharp.Core/Infrastructures/DistributedLocker.cs
+++ b/src/Infrastructure/BotSharp.Core/Infrastructures/DistributedLocker.cs
@@ -6,12 +6,12 @@ namespace BotSharp.Core.Infrastructures;
public class DistributedLocker : IDistributedLocker
{
- private readonly IConnectionMultiplexer _redis;
+ private readonly IServiceProvider _services;
private readonly ILogger _logger;
- public DistributedLocker(IConnectionMultiplexer redis, ILogger logger)
+ public DistributedLocker(IServiceProvider services, ILogger logger)
{
- _redis = redis;
+ _services = services;
_logger = logger;
}
@@ -19,7 +19,8 @@ public class DistributedLocker : IDistributedLocker
{
var timeout = TimeSpan.FromSeconds(timeoutInSeconds);
- var @lock = new RedisDistributedLock(resource, _redis.GetDatabase());
+ var redis = _services.GetRequiredService();
+ var @lock = new RedisDistributedLock(resource, redis.GetDatabase());
await using (var handle = await @lock.TryAcquireAsync(timeout))
{
if (handle == null)
@@ -37,7 +38,8 @@ public class DistributedLocker : IDistributedLocker
{
var timeout = TimeSpan.FromSeconds(timeoutInSeconds);
- var @lock = new RedisDistributedLock(resource, _redis.GetDatabase());
+ var redis = _services.GetRequiredService();
+ var @lock = new RedisDistributedLock(resource, redis.GetDatabase());
using (var handle = @lock.TryAcquire(timeout))
{
if (handle == null)