fix: satisfy revive unused-parameter and gofumpt in #3493 review findings

main
vicfei 2026-09-21 15:13:16 +08:00 committed by lyingbug
parent 2dd36212d6
commit 4b0dc3b687
2 changed files with 14 additions and 9 deletions

View File

@ -59,15 +59,21 @@ func TestResolveParentChunksResolvesSharedKBParentsAcrossTenants(t *testing.T) {
// All chunks belong to workspace 2; the caller is workspace 1.
repo := &tenantScopedChunkRepo{expandChunkRepo: &expandChunkRepo{
chunks: map[string]*types.Chunk{
"parent": {ID: "parent", TenantID: 2, ChunkType: types.ChunkTypeParentText,
Content: "shared parent body with ![img](resource://sharedImage)"},
"child": {ID: "child", TenantID: 2, ChunkType: types.ChunkTypeText,
ParentChunkID: "parent", Content: "shared child body"},
"parent": {
ID: "parent", TenantID: 2, ChunkType: types.ChunkTypeParentText,
Content: "shared parent body with ![img](resource://sharedImage)",
},
"child": {
ID: "child", TenantID: 2, ChunkType: types.ChunkTypeText,
ParentChunkID: "parent", Content: "shared child body",
},
},
children: map[string][]*types.Chunk{
"child": {
{ID: "imageChild", TenantID: 2, ParentChunkID: "child",
ChunkType: types.ChunkTypeImageOCR, ImageInfo: string(imageInfo), IsEnabled: true},
{
ID: "imageChild", TenantID: 2, ParentChunkID: "child",
ChunkType: types.ChunkTypeImageOCR, ImageInfo: string(imageInfo), IsEnabled: true,
},
},
},
}}

View File

@ -58,7 +58,7 @@ func CollectImageInfoByChunkIDs(
tenantID uint64,
chunkIDs []string,
) map[string]string {
return collectImageInfoByChunkIDs(ctx, chunkIDs, func(parentIDs []string) ([]*types.Chunk, error) {
return collectImageInfoByChunkIDs(chunkIDs, func(parentIDs []string) ([]*types.Chunk, error) {
return chunkRepo.ListChunksByParentIDs(ctx, tenantID, parentIDs)
})
}
@ -72,13 +72,12 @@ func CollectImageInfoByChunkIDsOnly(
chunkRepo interfaces.ChunkRepository,
chunkIDs []string,
) map[string]string {
return collectImageInfoByChunkIDs(ctx, chunkIDs, func(parentIDs []string) ([]*types.Chunk, error) {
return collectImageInfoByChunkIDs(chunkIDs, func(parentIDs []string) ([]*types.Chunk, error) {
return chunkRepo.ListChunksByParentIDsOnly(ctx, parentIDs)
})
}
func collectImageInfoByChunkIDs(
ctx context.Context,
chunkIDs []string,
listChildren func(parentIDs []string) ([]*types.Chunk, error),
) map[string]string {