feat: 支持多租户多模型对话及文档去重优化
This commit is contained in:
52
controller/model.go
Normal file
52
controller/model.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"rag/model/dto"
|
||||
"rag/service"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type model struct{}
|
||||
|
||||
var Model = new(model)
|
||||
|
||||
func (c *model) GetModelTypeEnums(ctx context.Context, req *dto.GetModelAllEnumsReq) (res *dto.GetModelEnumRes, err error) {
|
||||
res, err = service.ModelService.GetModelAllEnums(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *model) GetModelConfigFormFields(ctx context.Context, req *dto.GetModelConfigFormFieldsReq) (res *dto.GetModelConfigFormFieldsRes, err error) {
|
||||
res, err = service.ModelService.GetModelConfigFormFields(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *model) Create(ctx context.Context, req *dto.CreateModelReq) (res *dto.CreateModelRes, err error) {
|
||||
res, err = service.ModelService.Create(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *model) Update(ctx context.Context, req *dto.UpdateModelReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.ModelService.Update(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *model) Delete(ctx context.Context, req *dto.DeleteModelReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.ModelService.Delete(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *model) Get(ctx context.Context, req *dto.GetModelReq) (res *dto.ModelVO, err error) {
|
||||
res, err = service.ModelService.Get(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *model) List(ctx context.Context, req *dto.ListModelReq) (res *dto.ListModelRes, err error) {
|
||||
if !g.IsEmpty(req.Page) {
|
||||
req.Page = &beans.Page{PageNum: 1, PageSize: 20}
|
||||
}
|
||||
res, err = service.ModelService.List(ctx, req)
|
||||
return
|
||||
}
|
||||
16
controller/task.go
Normal file
16
controller/task.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"rag/model/dto"
|
||||
"rag/service"
|
||||
)
|
||||
|
||||
type task struct{}
|
||||
|
||||
var Task = new(task)
|
||||
|
||||
func (c *task) Get(ctx context.Context, req *dto.GetTaskReq) (res *dto.ListTaskRes, err error) {
|
||||
res, err = service.Task.Get(ctx, req)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user