feat: Support filtering chunks by multiple chunk_type params

This commit is contained in:
begoniezhao
2026-04-28 11:30:56 +08:00
committed by lyingbug
parent 8dc50b3921
commit 5c0243cd92
2 changed files with 13 additions and 1 deletions
+7
View File
@@ -128,7 +128,14 @@ func (h *ChunkHandler) ListKnowledgeChunks(c *gin.Context) {
pagination.PageSize = 100
}
// Default to text chunks; callers may override via ?chunk_type=image_caption etc.
chunkType := []types.ChunkType{types.ChunkTypeText}
if queryTypes := c.QueryArray("chunk_type"); len(queryTypes) > 0 {
chunkType = make([]types.ChunkType, 0, len(queryTypes))
for _, qt := range queryTypes {
chunkType = append(chunkType, types.ChunkType(qt))
}
}
// The route-level guard has rewritten the request's tenant context
// to the effective tenant for shared KBs.