1
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"rag-local/kb/model/dto"
|
||||
"rag-local/kb/service"
|
||||
)
|
||||
|
||||
type chunk struct{}
|
||||
|
||||
var Chunk = &chunk{}
|
||||
|
||||
func (c *chunk) List(ctx context.Context, req *dto.ListChunkReq) (*dto.ListChunkRes, error) {
|
||||
list, total, err := service.ChunkService.List(ctx, req.DocumentId, req.Page, req.PageSize)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &dto.ListChunkRes{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *chunk) Update(ctx context.Context, req *dto.UpdateChunkReq) (*dto.UpdateChunkRes, error) {
|
||||
if err := service.ChunkService.Update(ctx, req.Id, req.Content); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &dto.UpdateChunkRes{}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user