109 lines
3.9 KiB
Go
109 lines
3.9 KiB
Go
|
|
package dto
|
||
|
|
|
||
|
|
import (
|
||
|
|
"rag/consts/document"
|
||
|
|
|
||
|
|
"gitea.com/red-future/common/beans"
|
||
|
|
"github.com/gogf/gf/v2/frame/g"
|
||
|
|
"github.com/gogf/gf/v2/os/gtime"
|
||
|
|
)
|
||
|
|
|
||
|
|
// CreateDocumentReq 创建文件请求
|
||
|
|
type CreateDocumentReq struct {
|
||
|
|
g.Meta `path:"/createDocument" method:"post" tags:"文件管理" summary:"创建文件" dc:"创建文件"`
|
||
|
|
|
||
|
|
DatasetId int64 `json:"datasetId" v:"required#数据集ID不能为空"`
|
||
|
|
Title string `json:"title" v:"required#标题不能为空"`
|
||
|
|
Format string `json:"format" v:"required#格式不能为空"`
|
||
|
|
FileSize int64 `json:"fileSize" v:"required#大小不能为空"`
|
||
|
|
FilePath string `json:"filePath" v:"required#路径不能为空"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// CreateDocumentRes 创建文件响应
|
||
|
|
type CreateDocumentRes struct {
|
||
|
|
Id int64 `json:"id,string"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateDocumentReq 更新文件请求
|
||
|
|
type UpdateDocumentReq struct {
|
||
|
|
g.Meta `path:"/updateDocument" method:"put" tags:"文件管理" summary:"更新文件" dc:"更新文件"`
|
||
|
|
|
||
|
|
Id int64 `json:"id" v:"required#ID不能为空"`
|
||
|
|
Status document.Status `json:"status"`
|
||
|
|
VectorStatus document.VectorStatus `json:"vectorStatus"`
|
||
|
|
ChunkCount int64 `json:"chunkCount"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// DeleteDocumentReq 删除文件请求
|
||
|
|
type DeleteDocumentReq struct {
|
||
|
|
g.Meta `path:"/deleteDocument" method:"delete" tags:"文件管理" summary:"删除文件" dc:"删除文件"`
|
||
|
|
|
||
|
|
Id int64 `json:"id" v:"required#ID不能为空"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// GetDocumentReq 获取文件请求
|
||
|
|
type GetDocumentReq struct {
|
||
|
|
g.Meta `path:"/getDocument" method:"get" tags:"文件管理" summary:"获取文件详情" dc:"获取文件详情"`
|
||
|
|
|
||
|
|
Id int64 `json:"id" v:"required#ID不能为空"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// ListDocumentReq 文件列表请求
|
||
|
|
type ListDocumentReq struct {
|
||
|
|
g.Meta `path:"/listDocument" method:"get" tags:"文件管理" summary:"获取文件列表" dc:"分页查询文件列表,支持多条件筛选"`
|
||
|
|
|
||
|
|
Page *beans.Page `json:"page"`
|
||
|
|
DatasetId int64 `json:"datasetId"`
|
||
|
|
Keyword string `json:"keyword" dc:"关键词搜索"`
|
||
|
|
Status document.Status `json:"status"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// ListDocumentRes 文件列表响应
|
||
|
|
type ListDocumentRes struct {
|
||
|
|
List []*DocumentVO `json:"list"`
|
||
|
|
Total int `json:"total"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type DocumentVO struct {
|
||
|
|
Id int64 `json:"id,string" dc:"id"`
|
||
|
|
DatasetId int64 `json:"datasetId,string"`
|
||
|
|
Title string `json:"title" dc:"文件标题"`
|
||
|
|
Status document.Status `json:"status" dc:"状态1启用/0停用"`
|
||
|
|
VectorStatus document.VectorStatus `json:"vectorStatus" dc:"向量化状态 状态: 1 待定, 2 处理, 3 完成, 4 失败"`
|
||
|
|
ChunkCount int64 `json:"chunkCount" dc:"分块数"`
|
||
|
|
FileSize int64 `json:"fileSize" dc:"文件大小"`
|
||
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||
|
|
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// ProcessDocumentReq 处理文件请求(向量化)
|
||
|
|
type ProcessDocumentReq struct {
|
||
|
|
g.Meta `path:"/getProcess" method:"get" tags:"文件管理" summary:"文件向量化处理" dc:"文件向量化处理"`
|
||
|
|
|
||
|
|
Id int64 `json:"id" v:"required#ID不能为空"`
|
||
|
|
DatasetId int64 `json:"datasetId" v:"required#数据集ID不能为空"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// ProcessDocumentRes 处理文件响应
|
||
|
|
type ProcessDocumentRes struct {
|
||
|
|
ChunkCount int64 `json:"chunkCount"`
|
||
|
|
CostTime int64 `json:"costTime"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type ListDocumentChunkRPC struct {
|
||
|
|
List []*DocumentChunkRPC `json:"list"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type DocumentChunkRPC struct {
|
||
|
|
Id int64 `json:"id" dc:"id"`
|
||
|
|
DatasetId int64 `json:"datasetId" dc:"所属数据集ID"`
|
||
|
|
ContentHash string `json:"contentHash" dc:"内容hash"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type KnowledgeDocumentMsg struct {
|
||
|
|
TenantId uint64 `json:"tenantId"`
|
||
|
|
Creator string `json:"creator"`
|
||
|
|
Id int64 `json:"id"`
|
||
|
|
VectorStatus document.VectorStatus `json:"vectorStatus"`
|
||
|
|
}
|