chore(cli): adapt ListKnowledgeChunks interface to variadic chunk_type filter

Upstream commit 5c0243cd ("feat: Support filtering chunks by multiple
chunk_type params") extended client.Client.ListKnowledgeChunks with a
trailing `chunkTypes ...string` variadic. The two narrow service
interfaces in cli/ — ListService in cli/cmd/chunk/list.go and
chunkListService in cli/internal/mcp/tools.go — plus the two fake
implementations in their *_test.go siblings, are updated to match so
*client.Client continues to satisfy them via duck typing.

No CLI flag surfaced yet; both call sites pass no filter and behavior
is unchanged. Exposing `--chunk-type` as a flag on `weknora chunk list`
and as an input field on the MCP `chunk_list` tool is a candidate for a
follow-up commit, per the broader SDK-required → CLI-required alignment
discussion.

Pre-flight: go build ./... clean; go test -count=1 ./... 28/28 packages
pass; go vet ./... clean; gofmt -l . empty.
This commit is contained in:
nullkey
2026-05-25 20:21:41 +08:00
committed by lyingbug
parent 2ee9741fa1
commit b395db55de
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ var chunkListFields = []string{
// ListService is the narrow SDK surface this command depends on.
type ListService interface {
ListKnowledgeChunks(ctx context.Context, knowledgeID string, page, pageSize int) ([]sdk.Chunk, int64, error)
ListKnowledgeChunks(ctx context.Context, knowledgeID string, page, pageSize int, chunkTypes ...string) ([]sdk.Chunk, int64, error)
}
type ListOptions struct {
+1 -1
View File
@@ -28,7 +28,7 @@ type fakeListSvc struct {
callIdx int
}
func (f *fakeListSvc) ListKnowledgeChunks(_ context.Context, docID string, page, pageSize int) ([]sdk.Chunk, int64, error) {
func (f *fakeListSvc) ListKnowledgeChunks(_ context.Context, docID string, page, pageSize int, _ ...string) ([]sdk.Chunk, int64, error) {
f.calls = append(f.calls, listCall{docID, page, pageSize})
defer func() { f.callIdx++ }()
if f.callIdx >= len(f.pages) {