Skip to content

Commit 49c46e3

Browse files
committed
feat: rag indicators test
1 parent 3a0057e commit 49c46e3

18 files changed

+5162
-8
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ require (
1313
github.com/golang/mock v1.6.0
1414
github.com/google/uuid v1.6.0
1515
github.com/lib/pq v1.10.9
16+
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037
1617
github.com/panjf2000/ants/v2 v2.11.3
1718
github.com/redis/go-redis/v9 v9.10.0
1819
github.com/robfig/cron/v3 v3.0.1
@@ -84,7 +85,6 @@ require (
8485
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
8586
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
8687
github.com/nxadm/tail v1.4.11 // indirect
87-
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect
8888
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect
8989
github.com/oklog/ulid v1.3.1 // indirect
9090
github.com/onsi/gomega v1.36.2 // indirect

internal/store/vector/weaviate_wrapper.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"encoding/hex"
88
"encoding/json"
99
"fmt"
10+
"github.com/zeromicro/go-zero/core/logx"
1011
"io"
1112
"math"
1213
"net/http"
@@ -391,8 +392,8 @@ func (r *weaviateWrapper) unmarshalSimilarSearchResponse(res *models.GraphQLResp
391392
continue
392393
}
393394

394-
// content := getStringValue(obj, Content)
395-
content := ""
395+
content := getStringValue(obj, Content)
396+
396397
filePath := getStringValue(obj, MetadataFilePath)
397398

398399
// 从MetadataRange中提取startLine和endLine(用于构建映射键)
@@ -1024,7 +1025,7 @@ func (r *weaviateWrapper) InsertCodeChunks(ctx context.Context, docs []*types.Co
10241025
if err != nil {
10251026
return err
10261027
}
1027-
tracer.WithTrace(ctx).Infof("embedded %d chunks for codebase %s successfully", len(docs), docs[0].CodebaseName)
1028+
tracer.WithTrace(ctx).Infof("embedded %d chunks for codebase %s successfully", len(chunks), docs[0].CodebaseName)
10281029

10291030
objs := make([]*models.Object, len(chunks), len(chunks))
10301031
for i, c := range chunks {
@@ -1311,14 +1312,14 @@ func (r *weaviateWrapper) createClassWithAutoTenantEnabled(client *goweaviate.Cl
13111312
// generateTenantName 使用 MD5 哈希生成合规租户名(32字符,纯十六进制)
13121313
func (r *weaviateWrapper) generateTenantName(clientId string, codebasePath string) (string, error) {
13131314
// 添加调试日志
1314-
fmt.Printf("[DEBUG] generateTenantName - 输入 clientId: %s, codebasePath: %s\n", clientId, codebasePath)
1315+
logx.Debugf("[DEBUG] generateTenantName - 输入 clientId: %s, codebasePath: %s\n", clientId, codebasePath)
13151316

13161317
if codebasePath == types.EmptyString {
1317-
fmt.Printf("[DEBUG] generateTenantName - codebasePath 为空字符串\n")
1318+
logx.Debugf("[DEBUG] generateTenantName - codebasePath 为空字符串\n")
13181319
return types.EmptyString, ErrInvalidCodebasePath
13191320
}
13201321
if clientId == types.EmptyString {
1321-
fmt.Printf("[DEBUG] generateTenantName - clientId 为空字符串\n")
1322+
logx.Debugf("[DEBUG] generateTenantName - clientId 为空字符串\n")
13221323
return types.EmptyString, ErrInvalidClientId
13231324
}
13241325

@@ -1327,7 +1328,7 @@ func (r *weaviateWrapper) generateTenantName(clientId string, codebasePath strin
13271328
hash := md5.Sum([]byte(combined)) // 计算 MD5 哈希
13281329
tenantName := hex.EncodeToString(hash[:]) // 转为32位十六进制字符串
13291330

1330-
fmt.Printf("[DEBUG] generateTenantName - 生成的 tenantName: %s\n", tenantName)
1331+
logx.Debugf("[DEBUG] generateTenantName - 生成的 tenantName: %s\n", tenantName)
13311332
return tenantName, nil
13321333
}
13331334

0 commit comments

Comments
 (0)