1
This commit is contained in:
@@ -3,6 +3,7 @@ package controller
|
||||
import (
|
||||
"context"
|
||||
|
||||
"rag-local/kb/consts"
|
||||
"rag-local/kb/model/dto"
|
||||
"rag-local/kb/service"
|
||||
)
|
||||
@@ -48,9 +49,9 @@ func (c *document) Delete(ctx context.Context, req *dto.DeleteDocumentReq) (*dto
|
||||
}
|
||||
|
||||
func (c *document) Reembed(ctx context.Context, req *dto.ReembedDocumentReq) (*dto.ReembedDocumentRes, error) {
|
||||
n, err := service.DocumentService.Reembed(ctx, req.Id)
|
||||
if err != nil {
|
||||
// 入队由轮询器串行消费,避免同步重算阻塞 HTTP 且无法展示过程状态;已排队/处理中会跳过
|
||||
if err := service.ParseTaskService.Enqueue(ctx, req.Id, consts.TaskTypeReembed); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &dto.ReembedDocumentRes{Count: n}, nil
|
||||
return &dto.ReembedDocumentRes{}, nil
|
||||
}
|
||||
|
||||
@@ -23,3 +23,15 @@ func (c *kgEntity) List(ctx context.Context, req *dto.ListKgEntityReq) (*dto.Lis
|
||||
PageSize: req.PageSize,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *kgEntity) Sources(ctx context.Context, req *dto.SourcesKgEntityReq) (*dto.SourcesKgEntityRes, error) {
|
||||
list, err := service.KgEntityService.Sources(ctx, req.DatasetId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out := make([]*dto.KgEntitySourceItem, 0, len(list))
|
||||
for _, s := range list {
|
||||
out = append(out, &dto.KgEntitySourceItem{Name: s.Name, Files: s.Files})
|
||||
}
|
||||
return &dto.SourcesKgEntityRes{List: out}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user