Skip to content

Commit eac490e

Browse files
authored
Merge pull request #786 from iceljc/features/add-crontab-storage
add crontab storage
2 parents 8d176b5 + 4fa714f commit eac490e

File tree

22 files changed

+300
-20
lines changed

22 files changed

+300
-20
lines changed

BotSharp.sln

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Core.SideCar", "sr
121121
EndProject
122122
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.Plugin.VertexAI", "src\Plugins\BotSharp.Plugin.LangChain\BotSharp.Plugin.VertexAI.csproj", "{7DA2DCD0-551B-432E-AA5C-22DDD3ED459B}"
123123
EndProject
124+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.Core.Crontab", "src\Infrastructure\BotSharp.Core.Crontab\BotSharp.Core.Crontab.csproj", "{F812BAAE-5A7D-4DF7-8E71-70696B51C61F}"
125+
EndProject
124126
Global
125127
GlobalSection(SolutionConfigurationPlatforms) = preSolution
126128
Debug|Any CPU = Debug|Any CPU
@@ -489,6 +491,14 @@ Global
489491
{7DA2DCD0-551B-432E-AA5C-22DDD3ED459B}.Release|Any CPU.Build.0 = Release|Any CPU
490492
{7DA2DCD0-551B-432E-AA5C-22DDD3ED459B}.Release|x64.ActiveCfg = Release|Any CPU
491493
{7DA2DCD0-551B-432E-AA5C-22DDD3ED459B}.Release|x64.Build.0 = Release|Any CPU
494+
{F812BAAE-5A7D-4DF7-8E71-70696B51C61F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
495+
{F812BAAE-5A7D-4DF7-8E71-70696B51C61F}.Debug|Any CPU.Build.0 = Debug|Any CPU
496+
{F812BAAE-5A7D-4DF7-8E71-70696B51C61F}.Debug|x64.ActiveCfg = Debug|Any CPU
497+
{F812BAAE-5A7D-4DF7-8E71-70696B51C61F}.Debug|x64.Build.0 = Debug|Any CPU
498+
{F812BAAE-5A7D-4DF7-8E71-70696B51C61F}.Release|Any CPU.ActiveCfg = Release|Any CPU
499+
{F812BAAE-5A7D-4DF7-8E71-70696B51C61F}.Release|Any CPU.Build.0 = Release|Any CPU
500+
{F812BAAE-5A7D-4DF7-8E71-70696B51C61F}.Release|x64.ActiveCfg = Release|Any CPU
501+
{F812BAAE-5A7D-4DF7-8E71-70696B51C61F}.Release|x64.Build.0 = Release|Any CPU
492502
EndGlobalSection
493503
GlobalSection(SolutionProperties) = preSolution
494504
HideSolutionNode = FALSE
@@ -547,6 +557,7 @@ Global
547557
{F57F4862-F8D4-44A1-AC12-5C131B5C9785} = {51AFE054-AE99-497D-A593-69BAEFB5106F}
548558
{6D3A54F9-4792-41DB-BE7D-4F7B1D918EAE} = {E29DC6C4-5E57-48C5-BCB0-6B8F84782749}
549559
{7DA2DCD0-551B-432E-AA5C-22DDD3ED459B} = {D5293208-2BEF-42FC-A64C-5954F61720BA}
560+
{F812BAAE-5A7D-4DF7-8E71-70696B51C61F} = {E29DC6C4-5E57-48C5-BCB0-6B8F84782749}
550561
EndGlobalSection
551562
GlobalSection(ExtensibilityGlobals) = postSolution
552563
SolutionGuid = {A9969D89-C98B-40A5-A12B-FC87E55B3A19}

src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>$(TargetFramework)</TargetFramework>

src/Infrastructure/BotSharp.Core.Crontab/Models/CrontabItem.cs renamed to src/Infrastructure/BotSharp.Abstraction/Crontab/Models/CrontabItem.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
namespace BotSharp.Core.Crontab.Models;
1+
namespace BotSharp.Abstraction.Crontab.Models;
22

33
public class CrontabItem : ScheduleTaskArgs
44
{
5+
[JsonPropertyName("id")]
6+
public string Id { get; set; }
7+
8+
[JsonPropertyName("user_id")]
59
public string UserId { get; set; } = null!;
10+
11+
[JsonPropertyName("agent_id")]
612
public string AgentId { get; set; } = null!;
13+
14+
[JsonPropertyName("conversation_id")]
715
public string ConversationId { get; set; } = null!;
16+
17+
[JsonPropertyName("execution_result")]
818
public string ExecutionResult { get; set; } = null!;
919

20+
[JsonPropertyName("created_time")]
21+
public DateTime CreatedTime { get; set; } = DateTime.UtcNow;
22+
1023
public override string ToString()
1124
{
1225
return $"{Topic}: {Description} [AgentId: {AgentId}, UserId: {UserId}]";
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
namespace BotSharp.Abstraction.Crontab.Models;
2+
3+
public class CrontabItemFilter : Pagination
4+
{
5+
[JsonPropertyName("user_ids")]
6+
public IEnumerable<string>? UserIds { get; set; }
7+
8+
[JsonPropertyName("agent_ids")]
9+
public IEnumerable<string>? AgentIds { get; set; }
10+
11+
[JsonPropertyName("conversation_ids")]
12+
public IEnumerable<string>? ConversationIds { get; set; }
13+
14+
[JsonPropertyName("topics")]
15+
public IEnumerable<string>? Topics { get; set; }
16+
17+
public CrontabItemFilter()
18+
{
19+
20+
}
21+
22+
public static CrontabItemFilter Empty()
23+
{
24+
return new CrontabItemFilter();
25+
}
26+
}

src/Infrastructure/BotSharp.Core.Crontab/Models/ScheduleTaskArgs.cs renamed to src/Infrastructure/BotSharp.Abstraction/Crontab/Models/ScheduleTaskArgs.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System.Text.Json.Serialization;
2-
3-
namespace BotSharp.Core.Crontab.Models;
1+
namespace BotSharp.Abstraction.Crontab.Models;
42

53
public class ScheduleTaskArgs
64
{

src/Infrastructure/BotSharp.Abstraction/Repositories/IBotSharpRepository.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,9 @@ public interface IBotSharpRepository : IHaveServiceProvider
145145
bool DeleteKnolwedgeBaseFileMeta(string collectionName, string vectorStoreProvider, Guid? fileId = null);
146146
PagedItems<KnowledgeDocMetaData> GetKnowledgeBaseFileMeta(string collectionName, string vectorStoreProvider, KnowledgeFileFilter filter);
147147
#endregion
148+
149+
#region Crontab
150+
bool InsertCrontabItem(CrontabItem item) => throw new NotImplementedException();
151+
PagedItems<CrontabItem> GetCrontabItems(CrontabItemFilter filter) => throw new NotImplementedException();
152+
#endregion
148153
}

src/Infrastructure/BotSharp.Abstraction/Using.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
global using BotSharp.Abstraction.Messaging.Enums;
1818
global using BotSharp.Abstraction.Files.Models;
1919
global using BotSharp.Abstraction.Files.Enums;
20-
global using BotSharp.Abstraction.Knowledges.Models;
20+
global using BotSharp.Abstraction.Knowledges.Models;
21+
global using BotSharp.Abstraction.Crontab.Models;

src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabHook.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using BotSharp.Core.Crontab.Models;
2-
31
namespace BotSharp.Core.Crontab.Abstraction;
42

53
public interface ICrontabHook

src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabService.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using BotSharp.Core.Crontab.Models;
2-
31
namespace BotSharp.Core.Crontab.Abstraction;
42

53
public interface ICrontabService

src/Infrastructure/BotSharp.Core.Crontab/BotSharp.Core.Crontab.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@
2121
</ItemGroup>
2222

2323
<ItemGroup>
24-
<ProjectReference Include="..\BotSharp.Abstraction\BotSharp.Abstraction.csproj" />
2524
<ProjectReference Include="..\BotSharp.Core\BotSharp.Core.csproj" />
2625
</ItemGroup>
2726

2827
<ItemGroup>
2928
<PackageReference Include="NCrontab" Version="3.3.3" />
3029
</ItemGroup>
3130

31+
<ItemGroup>
32+
<Folder Include="Models\" />
33+
</ItemGroup>
34+
3235
</Project>

0 commit comments

Comments
 (0)