Skip to content

Commit d6d8299

Browse files
author
aden.chen
committed
Merge branch 'master' of https://github.com/adenchen123/BotSharp
2 parents 573cbb4 + cceff6f commit d6d8299

254 files changed

Lines changed: 3371 additions & 2052 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<TargetFramework>net8.0</TargetFramework>
44
<LangVersion>12.0</LangVersion>
5-
<BotSharpVersion>5.1.0</BotSharpVersion>
5+
<BotSharpVersion>5.2.0</BotSharpVersion>
66
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
77
<GenerateDocumentationFile>false</GenerateDocumentationFile>
88
</PropertyGroup>

Directory.Packages.props

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<PackageVersion Include="EntityFramework" Version="6.4.4" />
99
<PackageVersion Include="Google_GenerativeAI" Version="3.3.0" />
1010
<PackageVersion Include="Google_GenerativeAI.Live" Version="3.3.0" />
11-
<PackageVersion Include="LLMSharp.Google.Palm" Version="1.0.2" />
1211
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="$(AspNetCoreVersion)" />
1312
<PackageVersion Include="Microsoft.AspNetCore.StaticFiles" Version="$(AspNetCoreVersion)" />
1413
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
@@ -23,7 +22,7 @@
2322
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.11" />
2423
<PackageVersion Include="System.ClientModel" Version="1.3.0" />
2524
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
26-
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.0.0" />
25+
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.14.0" />
2726
<PackageVersion Include="System.Memory.Data" Version="8.0.0" />
2827
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
2928
<PackageVersion Include="System.Reactive" Version="6.0.1" />
@@ -32,20 +31,20 @@
3231
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
3332
<PackageVersion Include="Rougamo.Fody" Version="5.0.0" />
3433
<PackageVersion Include="Aspects.Cache" Version="2.0.4" />
35-
<PackageVersion Include="DistributedLock.Redis" Version="1.0.3" />
34+
<PackageVersion Include="DistributedLock.Redis" Version="1.1.0" />
3635
<PackageVersion Include="EntityFrameworkCore.BootKit" Version="8.9.0" />
3736
<PackageVersion Include="Fluid.Core" Version="2.11.1" />
3837
<PackageVersion Include="Nanoid" Version="3.1.0" />
3938
<PackageVersion Include="Swashbuckle.AspNetCore" Version="8.1.2" />
4039
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="8.0.1" />
41-
<PackageVersion Include="Anthropic.SDK" Version="5.5.0" />
40+
<PackageVersion Include="Anthropic.SDK" Version="5.7.1" />
4241
<PackageVersion Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
4342
<PackageVersion Include="NAudio" Version="2.2.1" />
4443
<PackageVersion Include="NAudio.Core" Version="2.2.1" />
4544
<PackageVersion Include="Whisper.net" Version="1.8.1" />
4645
<PackageVersion Include="Whisper.net.Runtime" Version="1.8.1" />
4746
<PackageVersion Include="NCrontab" Version="3.3.3" />
48-
<PackageVersion Include="Azure.AI.OpenAI" Version="2.3.0-beta.2" />
47+
<PackageVersion Include="Azure.AI.OpenAI" Version="2.5.0-beta.1" />
4948
<PackageVersion Include="OpenAI" Version="2.5.0" />
5049
<PackageVersion Include="MailKit" Version="4.11.0" />
5150
<PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.8" />
@@ -57,11 +56,11 @@
5756
<PackageVersion Include="Jint" Version="4.1.0" />
5857
<PackageVersion Include="PdfPig" Version="0.1.8" />
5958
<PackageVersion Include="TensorFlow.Keras" Version="0.15.0" />
60-
<PackageVersion Include="LangChain.Providers.Google.VertexAI" Version="0.15.3-dev.58" />
59+
<PackageVersion Include="LangChain.Providers.Google.VertexAI" Version="0.17.1-dev.48" />
6160
<PackageVersion Include="LLamaSharp" Version="0.21.0" />
6261
<PackageVersion Include="FaissMask" Version="0.4.2" />
6362
<PackageVersion Include="FastText.NetWrapper" Version="1.3.1" />
64-
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="9.5.0" />
63+
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="9.10.0" />
6564
<PackageVersion Include="System.Text.Encodings.Web" Version="8.0.0" />
6665
<PackageVersion Include="MongoDB.Driver" Version="3.1.0" />
6766
<PackageVersion Include="Docnet.Core" Version="2.7.0-alpha.1" />
@@ -74,17 +73,17 @@
7473
<PackageVersion Include="Sdcb.PaddleOCR.Models.LocalV3" Version="2.7.0.1" />
7574
<PackageVersion Include="System.Drawing.Common" Version="8.0.14" />
7675
<PackageVersion Include="pythonnet" Version="3.0.5" />
77-
<PackageVersion Include="Qdrant.Client" Version="1.15.0" />
76+
<PackageVersion Include="Qdrant.Client" Version="1.15.1" />
7877
<PackageVersion Include="Selenium.WebDriver" Version="4.27.0" />
7978
<PackageVersion Include="HtmlAgilityPack" Version="1.12.0" />
80-
<PackageVersion Include="Microsoft.SemanticKernel.Abstractions" Version="1.16.0" />
79+
<PackageVersion Include="Microsoft.SemanticKernel.Abstractions" Version="1.66.0" />
8180
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.Memory" Version="1.16.0-alpha" />
8281
<PackageVersion Include="Microsoft.VisualStudio.Validation" Version="17.8.8" />
8382
<PackageVersion Include="Sdcb.SparkDesk" Version="3.1.0" />
8483
<PackageVersion Include="MySqlConnector" Version="2.4.0" />
8584
<PackageVersion Include="Npgsql" Version="8.0.7" />
8685
<PackageVersion Include="Tencent.QCloud.Cos.Sdk" Version="5.4.39" />
87-
<PackageVersion Include="StackExchange.Redis" Version="2.7.27" />
86+
<PackageVersion Include="StackExchange.Redis" Version="2.7.33" />
8887
<PackageVersion Include="StrongGrid" Version="0.108.0" />
8988
<PackageVersion Include="Twilio.AspNet.Common" Version="8.1.1" />
9089
<PackageVersion Include="Twilio.AspNet.Core" Version="8.1.1" />

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,11 @@ BotSharp uses component design, the kernel is kept to a minimum, and business fu
115115
- BotSharp.Plugin.Dashboard
116116
- BotSharp.Plugin.RoutingSpeeder
117117
- BotSharp.Plugin.AudioHandler
118+
- BotSharp.Plugin.ChartHandler
118119
- BotSharp.Plugin.EmailHandler
120+
- BotSharp.Plugin.ExcelHandler
119121
- BotSharp.Plugin.FileHandler
122+
- BotSharp.Plugin.ImageHandler
120123
- BotSharp.Plugin.HttpHandler
121124
- BotSharp.Plugin.SqlDriver
122125
- BotSharp.Plugin.WebDriver
@@ -130,7 +133,7 @@ BotSharp uses component design, the kernel is kept to a minimum, and business fu
130133
- [x] MCP
131134
- [x] Realtime
132135
- [ ] Computer Use
133-
- [x] Browser Use
136+
- [ ] Browser Use
134137
- [x] Database Assistant
135138
- [x] Code Interpreter
136139
- [x] Conversation Management

src/Infrastructure/BotSharp.Abstraction/Agents/AgentHookBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public virtual bool OnAgentLoading(ref string id)
2929
return true;
3030
}
3131

32-
public virtual bool OnInstructionLoaded(string template, Dictionary<string, object> dict)
32+
public virtual bool OnInstructionLoaded(string template, IDictionary<string, object> dict)
3333
{
3434
dict["current_date"] = $"{DateTime.Now:MMM dd, yyyy}";
3535
dict["current_time"] = $"{DateTime.Now:hh:mm tt}";

src/Infrastructure/BotSharp.Abstraction/Agents/IAgentHook.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public interface IAgentHook : IHookBase
1616
/// <returns></returns>
1717
bool OnAgentLoading(ref string id);
1818

19-
bool OnInstructionLoaded(string template, Dictionary<string, object> dict);
19+
bool OnInstructionLoaded(string template, IDictionary<string, object> dict);
2020

2121
bool OnFunctionsLoaded(List<FunctionDef> functions);
2222

src/Infrastructure/BotSharp.Abstraction/Agents/IAgentService.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using BotSharp.Abstraction.Agents.Options;
2+
using BotSharp.Abstraction.Coding.Models;
3+
using BotSharp.Abstraction.Coding.Options;
24
using BotSharp.Abstraction.Functions.Models;
35
using BotSharp.Abstraction.Plugins.Models;
46
using BotSharp.Abstraction.Repositories.Filters;
@@ -30,18 +32,18 @@ public interface IAgentService
3032
/// <returns></returns>
3133
Task InheritAgent(Agent agent);
3234

33-
string RenderInstruction(Agent agent, Dictionary<string, object>? renderData = null);
35+
string RenderInstruction(Agent agent, IDictionary<string, object>? renderData = null);
3436

35-
string RenderTemplate(Agent agent, string templateName, Dictionary<string, object>? renderData = null);
37+
string RenderTemplate(Agent agent, string templateName, IDictionary<string, object>? renderData = null);
3638

37-
bool RenderFunction(Agent agent, FunctionDef def, Dictionary<string, object>? renderData = null);
39+
bool RenderFunction(Agent agent, FunctionDef def, IDictionary<string, object>? renderData = null);
3840

39-
FunctionParametersDef? RenderFunctionProperty(Agent agent, FunctionDef def, Dictionary<string, object>? renderData = null);
41+
FunctionParametersDef? RenderFunctionProperty(Agent agent, FunctionDef def, IDictionary<string, object>? renderData = null);
4042

41-
(string, IEnumerable<FunctionDef>) PrepareInstructionAndFunctions(Agent agent, Dictionary<string, object>? renderData = null, StringComparer? comparer = null);
43+
(string, IEnumerable<FunctionDef>) PrepareInstructionAndFunctions(Agent agent, IDictionary<string, object>? renderData = null, StringComparer? comparer = null);
4244

43-
bool RenderVisibility(string? visibilityExpression, Dictionary<string, object> dict);
44-
Dictionary<string, object> CollectRenderData(Agent agent);
45+
bool RenderVisibility(string? visibilityExpression, IDictionary<string, object> dict);
46+
IDictionary<string, object> CollectRenderData(Agent agent);
4547

4648

4749
/// <summary>
@@ -51,7 +53,7 @@ public interface IAgentService
5153
/// <returns>Original agent information</returns>
5254
Task<Agent> GetAgent(string id);
5355

54-
Task<bool> DeleteAgent(string id);
56+
Task<bool> DeleteAgent(string id, AgentDeleteOptions? options = null);
5557
Task UpdateAgent(Agent agent, AgentField updateField);
5658

5759
/// <summary>
@@ -75,4 +77,10 @@ Task<List<AgentCodeScript>> GetAgentCodeScripts(string agentId, AgentCodeScriptF
7577

7678
Task<bool> UpdateAgentCodeScripts(string agentId, List<AgentCodeScript> codeScripts, AgentCodeScriptUpdateOptions? options = null)
7779
=> Task.FromResult(false);
80+
81+
Task<bool> DeleteAgentCodeScripts(string agentId, List<AgentCodeScript>? codeScripts = null)
82+
=> Task.FromResult(false);
83+
84+
Task<CodeGenerationResult> GenerateCodeScript(string agentId, string text, CodeProcessOptions? options = null)
85+
=> Task.FromResult(new CodeGenerationResult());
7886
}

src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentLlmConfig.cs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,11 @@ public class AgentLlmConfig
4343
public string? ReasoningEffortLevel { get; set; }
4444

4545
/// <summary>
46-
/// Image generation config
46+
/// Image composition config
4747
/// </summary>
48-
[JsonPropertyName("image_generation")]
48+
[JsonPropertyName("image_composition")]
4949
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
50-
public LlmImageGenerationConfig? ImageGeneration { get; set; }
51-
52-
/// <summary>
53-
/// Image edit config
54-
/// </summary>
55-
[JsonPropertyName("image_edit")]
56-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
57-
public LlmImageEditConfig? ImageEdit { get; set; }
50+
public LlmImageCompositionConfig? ImageComposition { get; set; }
5851

5952
/// <summary>
6053
/// Audio transcription config
@@ -71,12 +64,7 @@ public class AgentLlmConfig
7164
public LlmRealtimeConfig? Realtime { get; set; }
7265
}
7366

74-
75-
public class LlmImageGenerationConfig : LlmProviderModel
76-
{
77-
}
78-
79-
public class LlmImageEditConfig : LlmProviderModel
67+
public class LlmImageCompositionConfig : LlmProviderModel
8068
{
8169
}
8270

src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentRule.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ namespace BotSharp.Abstraction.Agents.Models;
33
public class AgentRule
44
{
55
[JsonPropertyName("trigger_name")]
6-
public string TriggerName { get; set; }
6+
public string TriggerName { get; set; } = string.Empty;
77

88
[JsonPropertyName("disabled")]
99
public bool Disabled { get; set; }
1010

1111
[JsonPropertyName("criteria")]
12-
public string Criteria { get; set; }
12+
public string Criteria { get; set; } = string.Empty;
1313
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
using BotSharp.Abstraction.Repositories.Models;
1+
using BotSharp.Abstraction.Repositories.Options;
22

33
namespace BotSharp.Abstraction.Agents.Options;
44

55
public class AgentCodeScriptUpdateOptions : AgentCodeScriptDbUpdateOptions
66
{
7+
[JsonPropertyName("delete_if_not_included")]
78
public bool DeleteIfNotIncluded { get; set; }
8-
}
9+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace BotSharp.Abstraction.Agents.Options;
2+
3+
public class AgentDeleteOptions
4+
{
5+
[JsonPropertyName("delete_role_agents")]
6+
public bool DeleteRoleAgents { get; set; }
7+
8+
[JsonPropertyName("delete_user_agents")]
9+
public bool DeleteUserAgents { get; set; }
10+
11+
[JsonPropertyName("to_delete_code_scripts")]
12+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
13+
public List<AgentCodeScript>? ToDeleteCodeScripts { get; set; }
14+
}

0 commit comments

Comments
 (0)