refactor: 重构文档向量相关代码结构
This commit is contained in:
35
controller/document_vector.go
Normal file
35
controller/document_vector.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"rag/model/dto"
|
||||
"rag/service"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type documentVector struct{}
|
||||
|
||||
var DocumentVector = new(documentVector)
|
||||
|
||||
// Query 执行RAG查询
|
||||
func (c *documentVector) Query(ctx context.Context, req *dto.RAGQueryReq) (res *dto.RAGQueryRes, err error) {
|
||||
res, err = service.DocumentVector.Query(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Update 更新文件片段
|
||||
func (c *documentVector) Update(ctx context.Context, req *dto.UpdateDocumentVectorReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.DocumentVector.Update(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// List 文件片段列表
|
||||
func (c *documentVector) List(ctx context.Context, req *dto.ListDocumentVectorReq) (res *dto.ListDocumentVectorRes, err error) {
|
||||
if !g.IsEmpty(req.Page) {
|
||||
req.Page = &beans.Page{PageNum: 1, PageSize: 20}
|
||||
}
|
||||
res, err = service.DocumentVector.List(ctx, req)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user