From 4b5277c87ecddaf7ee6d2a33bfbb13c6589b76f7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 1 Nov 2025 05:33:44 +0000 Subject: [PATCH 1/2] Initial plan From 71f90067efd390bf385b75b59a97204a6e5da9bc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 1 Nov 2025 05:39:03 +0000 Subject: [PATCH 2/2] Fix VectorStore lifecycle management and remove incorrect using statement Co-authored-by: JeffreySu <2281927+JeffreySu@users.noreply.github.com> --- .../KernelConfigExtensions.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Senparc.AI.Kernel/KernelConfigExtensions/KernelConfigExtensions.cs b/src/Senparc.AI.Kernel/KernelConfigExtensions/KernelConfigExtensions.cs index 760ba86..509223d 100644 --- a/src/Senparc.AI.Kernel/KernelConfigExtensions/KernelConfigExtensions.cs +++ b/src/Senparc.AI.Kernel/KernelConfigExtensions/KernelConfigExtensions.cs @@ -239,6 +239,12 @@ public static IWantToConfig ConfigVectorStore(this IWantToConfig iWantToConfig, /// /// /// + /// + /// Note: VectorStore instances created in this method are not explicitly disposed. + /// The VectorStoreCollection returned may maintain a reference to the VectorStore and require it to remain alive. + /// For proper resource management, consider using dependency injection to manage VectorStore lifecycle + /// or ensure the collection is disposed when no longer needed. + /// public static VectorStoreCollection GetVectorCollection(this IWantToRun iWwantToRun, VectorDB vectorDb, string name, VectorStoreCollectionDefinition? vectorStoreRecordDefinition = null) where TKey : notnull where TRecord : class @@ -264,11 +270,9 @@ public static VectorStoreCollection GetVectorCollection(name, vectorStoreRecordDefinition); - } + vectorStore = new RedisVectorStore(database, + new() { StorageType = RedisStorageType.Json }); + collection = vectorStore.GetCollection(name, vectorStoreRecordDefinition); break; } case VectorDBType.Milvus: