From 65743da754e30ee1f5a3a4b163994a9abe298440 Mon Sep 17 00:00:00 2001 From: DaWesen <3880255095@qq.com> Date: Thu, 5 Mar 2026 21:49:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Milvus=20retriever?= =?UTF-8?q?=20=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修正 envMilvusCollection 字段名拼写错误 - 将 log.Errorf 中的 %w 改为 %v,修复日志格式化问题 - 保留错误包装功能,确保错误处理的完整性 --- .../application/repository/retriever/milvus/repository.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/application/repository/retriever/milvus/repository.go b/internal/application/repository/retriever/milvus/repository.go index 6e52b9da..3f8d8137 100644 --- a/internal/application/repository/retriever/milvus/repository.go +++ b/internal/application/repository/retriever/milvus/repository.go @@ -20,7 +20,7 @@ import ( ) const ( - envQdrantCollection = "MILVUS_COLLECTION" + envMilvusCollection = "MILVUS_COLLECTION" defaultCollectionName = "weknora_embeddings" fieldContent = "content" fieldSourceID = "source_id" @@ -45,7 +45,7 @@ func NewMilvusRetrieveEngineRepository(client *client.Client) interfaces.Retriev log := logger.GetLogger(context.Background()) log.Info("[Milvus] Initializing Milvus retriever engine repository") - collectionBaseName := os.Getenv(envQdrantCollection) + collectionBaseName := os.Getenv(envMilvusCollection) if collectionBaseName == "" { log.Warn("[Milvus] MILVUS_COLLECTION environment variable not set, using default collection name") collectionBaseName = defaultCollectionName @@ -506,7 +506,7 @@ func (m *milvusRepository) BatchUpdateChunkTagID(ctx context.Context, chunkTagMa // Get all collections collections, err := m.client.ListCollections(ctx, client.NewListCollectionOption()) if err != nil { - log.Errorf("[Milvus] Failed to list collections: %w", err) + log.Errorf("[Milvus] Failed to list collections: %v", err) return fmt.Errorf("failed to list collections: %w", err) }