fix: 修复 Milvus retriever 相关问题

- 修正 envMilvusCollection 字段名拼写错误
- 将 log.Errorf 中的 %w 改为 %v,修复日志格式化问题
- 保留错误包装功能,确保错误处理的完整性
This commit is contained in:
DaWesen
2026-03-05 21:49:17 +08:00
committed by lyingbug
parent 6dde1330c2
commit 65743da754
@@ -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)
}