Skip to content

Commit 26ff3ce

Browse files
authored
Merge pull request #1123 from iceljc/features/refine-vector-store
Features/refine vector store
2 parents 018df7e + 48931e2 commit 26ff3ce

File tree

52 files changed

+693
-370
lines changed

Some content is hidden

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

52 files changed

+693
-370
lines changed

Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<PackageVersion Include="Whisper.net.Runtime" Version="1.8.1" />
4747
<PackageVersion Include="NCrontab" Version="3.3.3" />
4848
<PackageVersion Include="Azure.AI.OpenAI" Version="2.2.0-beta.5" />
49-
<PackageVersion Include="OpenAI" Version="2.2.0" />
49+
<PackageVersion Include="OpenAI" Version="2.3.0" />
5050
<PackageVersion Include="MailKit" Version="4.11.0" />
5151
<PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.8" />
5252
<PackageVersion Include="MySql.Data" Version="9.0.0" />
@@ -74,7 +74,7 @@
7474
<PackageVersion Include="Sdcb.PaddleOCR.Models.LocalV3" Version="2.7.0.1" />
7575
<PackageVersion Include="System.Drawing.Common" Version="8.0.14" />
7676
<PackageVersion Include="pythonnet" Version="3.0.4" />
77-
<PackageVersion Include="Qdrant.Client" Version="1.13.0" />
77+
<PackageVersion Include="Qdrant.Client" Version="1.15.0" />
7878
<PackageVersion Include="Selenium.WebDriver" Version="4.27.0" />
7979
<PackageVersion Include="HtmlAgilityPack" Version="1.12.0" />
8080
<PackageVersion Include="Microsoft.SemanticKernel.Abstractions" Version="1.16.0" />

src/Infrastructure/BotSharp.Abstraction/Knowledges/IKnowledgeService.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using BotSharp.Abstraction.Graph.Models;
2+
using BotSharp.Abstraction.Models;
23
using BotSharp.Abstraction.VectorStorage.Models;
34

45
namespace BotSharp.Abstraction.Knowledges;
@@ -13,6 +14,7 @@ public interface IKnowledgeService
1314
Task<VectorCollectionDetails?> GetVectorCollectionDetails(string collectionName);
1415
Task<IEnumerable<VectorSearchResult>> SearchVectorKnowledge(string query, string collectionName, VectorSearchOptions options);
1516
Task<StringIdPagedItems<VectorSearchResult>> GetPagedVectorCollectionData(string collectionName, VectorFilter filter);
17+
Task<IEnumerable<VectorCollectionData>> GetVectorCollectionData(string collectionName, IEnumerable<string> ids, VectorQueryOptions? options = null);
1618
Task<bool> DeleteVectorCollectionData(string collectionName, string id);
1719
Task<bool> DeleteVectorCollectionAllData(string collectionName);
1820
Task<bool> CreateVectorCollectionData(string collectionName, VectorCreateModel create);
@@ -69,6 +71,11 @@ Task<bool> ImportDocumentContentToKnowledge(string collectionName, string fileNa
6971
Task<bool> DeleteVectorCollectionSnapshot(string collectionName, string snapshotName);
7072
#endregion
7173

74+
#region Index
75+
Task<SuccessFailResponse<string>> CreateVectorCollectionPayloadIndexes(string collectionName, IEnumerable<CreateVectorCollectionIndexOptions> options);
76+
Task<SuccessFailResponse<string>> DeleteVectorCollectionPayloadIndexes(string collectionName, IEnumerable<DeleteVectorCollectionIndexOptions> options);
77+
#endregion
78+
7279
#region Common
7380
Task<bool> RefreshVectorKnowledgeConfigs(VectorCollectionConfigsModel configs);
7481
#endregion
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace BotSharp.Abstraction.Models;
2+
3+
public class SuccessFailResponse<T>
4+
{
5+
public List<T> Success { get; set; } = [];
6+
public List<T> Fail { get; set; } = [];
7+
}

src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/ConversationStateKeysFilter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ public class ConversationStateKeysFilter
88
public bool PreLoad { get; set; }
99
public List<string>? AgentIds { get; set; }
1010
public List<string>? UserIds { get; set; }
11+
public DateTime? StartTime { get; set; }
12+
public DateTime? EndTime { get; set; }
1113

1214
public ConversationStateKeysFilter()
1315
{

src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/InstructLogFilter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ public class InstructLogFilter : Pagination
88
public List<string>? TemplateNames { get; set; }
99
public List<string>? UserIds { get; set; }
1010
public List<KeyValue>? States { get; set; }
11+
public DateTime? StartTime { get; set; }
12+
public DateTime? EndTime { get; set; }
1113

1214
public static InstructLogFilter Empty()
1315
{

src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/InstructLogKeysFilter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ public class InstructLogKeysFilter
88
public bool PreLoad { get; set; }
99
public List<string>? AgentIds { get; set; }
1010
public List<string>? UserIds { get; set; }
11+
public DateTime? StartTime { get; set; }
12+
public DateTime? EndTime { get; set; }
1113

1214
public InstructLogKeysFilter()
1315
{

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bool UpdateRole(Role role, bool updateRoleAgents = false)
5656
void UpdateUserPhone(string userId, string Iphone, string regionCode) => throw new NotImplementedException();
5757
void UpdateUserIsDisable(string userId, bool isDisable) => throw new NotImplementedException();
5858
void UpdateUsersIsDisable(List<string> userIds, bool isDisable) => throw new NotImplementedException();
59-
PagedItems<User> GetUsers(UserFilter filter) => throw new NotImplementedException();
59+
ValueTask<PagedItems<User>> GetUsers(UserFilter filter) => throw new NotImplementedException();
6060
List<User> SearchLoginUsers(User filter, string source = UserSource.Internal) =>throw new NotImplementedException();
6161
User? GetUserDetails(string userId, bool includeAgent = false) => throw new NotImplementedException();
6262
bool UpdateUser(User user, bool updateUserAgents = false) => throw new NotImplementedException();
@@ -93,7 +93,7 @@ bool AppendAgentLabels(string agentId, List<string> labels)
9393
#endregion
9494

9595
#region Agent Task
96-
PagedItems<AgentTask> GetAgentTasks(AgentTaskFilter filter)
96+
ValueTask<PagedItems<AgentTask>> GetAgentTasks(AgentTaskFilter filter)
9797
=> throw new NotImplementedException();
9898
AgentTask? GetAgentTask(string agentId, string taskId)
9999
=> throw new NotImplementedException();
@@ -126,7 +126,7 @@ void UpdateConversationStatus(string conversationId, string status)
126126
=> throw new NotImplementedException();
127127
Conversation GetConversation(string conversationId, bool isLoadStates = false)
128128
=> throw new NotImplementedException();
129-
PagedItems<Conversation> GetConversations(ConversationFilter filter)
129+
ValueTask<PagedItems<Conversation>> GetConversations(ConversationFilter filter)
130130
=> throw new NotImplementedException();
131131
void UpdateConversationTitle(string conversationId, string title)
132132
=> throw new NotImplementedException();
@@ -179,7 +179,7 @@ DateTimePagination<ConversationStateLogModel> GetConversationStateLogs(string co
179179
bool SaveInstructionLogs(IEnumerable<InstructionLogModel> logs)
180180
=> throw new NotImplementedException();
181181

182-
PagedItems<InstructionLogModel> GetInstructionLogs(InstructLogFilter filter)
182+
ValueTask<PagedItems<InstructionLogModel>> GetInstructionLogs(InstructLogFilter filter)
183183
=> throw new NotImplementedException();
184184

185185
List<string> GetInstructionLogSearchKeys(InstructLogKeysFilter filter)
@@ -227,7 +227,7 @@ bool SaveKnolwedgeBaseFileMeta(KnowledgeDocMetaData metaData)
227227
/// <returns></returns>
228228
bool DeleteKnolwedgeBaseFileMeta(string collectionName, string vectorStoreProvider, Guid? fileId = null)
229229
=> throw new NotImplementedException();
230-
PagedItems<KnowledgeDocMetaData> GetKnowledgeBaseFileMeta(string collectionName, string vectorStoreProvider, KnowledgeFileFilter filter)
230+
ValueTask<PagedItems<KnowledgeDocMetaData>> GetKnowledgeBaseFileMeta(string collectionName, string vectorStoreProvider, KnowledgeFileFilter filter)
231231
=> throw new NotImplementedException();
232232
#endregion
233233

@@ -236,7 +236,7 @@ bool UpsertCrontabItem(CrontabItem cron)
236236
=> throw new NotImplementedException();
237237
bool DeleteCrontabItem(string conversationId)
238238
=> throw new NotImplementedException();
239-
PagedItems<CrontabItem> GetCrontabItems(CrontabItemFilter filter)
239+
ValueTask<PagedItems<CrontabItem>> GetCrontabItems(CrontabItemFilter filter)
240240
=> throw new NotImplementedException();
241241
#endregion
242242
}

src/Infrastructure/BotSharp.Abstraction/Users/IUserService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace BotSharp.Abstraction.Users;
77
public interface IUserService
88
{
99
Task<User> GetUser(string id);
10+
Task<List<User>> GetUsers(List<string> ids);
1011
Task<PagedItems<User>> GetUsers(UserFilter filter);
1112
Task<List<User>> SearchLoginUsers(User filter);
1213
Task<User?> GetUserDetails(string userId, bool includeAgent = false);

src/Infrastructure/BotSharp.Abstraction/Utilities/Pagination.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ public string GetCacheKey()
5050

5151
public class PagedItems<T>
5252
{
53-
public int Count { get; set; }
53+
public long Count { get; set; }
5454
public IEnumerable<T> Items { get; set; } = new List<T>();
5555
}

src/Infrastructure/BotSharp.Abstraction/VectorStorage/IVectorDb.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@ Task<IEnumerable<string>> GetCollections()
1414
=> throw new NotImplementedException();
1515
Task<StringIdPagedItems<VectorCollectionData>> GetPagedCollectionData(string collectionName, VectorFilter filter)
1616
=> throw new NotImplementedException();
17-
Task<IEnumerable<VectorCollectionData>> GetCollectionData(string collectionName, IEnumerable<Guid> ids,
18-
bool withPayload = false, bool withVector = false)
17+
Task<IEnumerable<VectorCollectionData>> GetCollectionData(string collectionName, IEnumerable<Guid> ids, VectorQueryOptions? options = null)
1918
=> throw new NotImplementedException();
2019
Task<bool> CreateCollection(string collectionName, int dimension)
2120
=> throw new NotImplementedException();
2221
Task<bool> DeleteCollection(string collectionName)
2322
=> throw new NotImplementedException();
2423
Task<bool> Upsert(string collectionName, Guid id, float[] vector, string text, Dictionary<string, object>? payload = null)
2524
=> throw new NotImplementedException();
26-
Task<IEnumerable<VectorCollectionData>> Search(string collectionName, float[] vector, IEnumerable<string>? fields,
27-
int limit = 5, float confidence = 0.5f, bool withVector = false)
25+
Task<IEnumerable<VectorCollectionData>> Search(string collectionName, float[] vector, VectorSearchOptions? options = null)
2826
=> throw new NotImplementedException();
2927
Task<bool> DeleteCollectionData(string collectionName, List<Guid> ids)
3028
=> throw new NotImplementedException();
@@ -40,4 +38,9 @@ Task<bool> RecoverCollectionFromShapshot(string collectionName, string snapshotF
4038
=> throw new NotImplementedException();
4139
Task<bool> DeleteCollectionShapshot(string collectionName, string snapshotName)
4240
=> throw new NotImplementedException();
41+
42+
Task<bool> CreateCollectionPayloadIndex(string collectionName, CreateVectorCollectionIndexOptions options)
43+
=> throw new NotImplementedException();
44+
Task<bool> DeleteCollectionPayloadIndex(string collectionName, DeleteVectorCollectionIndexOptions options)
45+
=> throw new NotImplementedException();
4346
}

0 commit comments

Comments
 (0)