65 lines
2.8 KiB
Go
65 lines
2.8 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"
|
||
|
|
"github.com/pgvector/pgvector-go"
|
||
|
|
)
|
||
|
|
|
||
|
|
// UpdateDocumentChunkReq 更新文件块向量请求
|
||
|
|
type UpdateDocumentChunkReq struct {
|
||
|
|
g.Meta `path:"/updateDocumentChunk" method:"put" tags:"文件块向量管理" summary:"更新文件块" dc:"更新文件块"`
|
||
|
|
|
||
|
|
Id int64 `json:"id" v:"required#ID不能为空"`
|
||
|
|
Status document.Status `json:"status"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// ListDocumentChunkReq 文件块向量列表请求
|
||
|
|
type ListDocumentChunkReq struct {
|
||
|
|
g.Meta `path:"/listDocumentChunk" method:"get" tags:"文件块向量管理" summary:"获取文件块向量列表" dc:"分页查询文件块向量列表,支持多条件筛选"`
|
||
|
|
|
||
|
|
Page *beans.Page `json:"page"`
|
||
|
|
DatasetId int64 `json:"datasetId"`
|
||
|
|
DocumentId int64 `json:"documentId"`
|
||
|
|
Status document.Status `json:"status"`
|
||
|
|
VectorStatus document.VectorStatus `json:"vectorStatus"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// ListDocumentChunkRes 文件块向量列表响应
|
||
|
|
type ListDocumentChunkRes struct {
|
||
|
|
List []*DocumentChunkItem `json:"list"`
|
||
|
|
Total int `json:"total"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type DocumentChunkItem struct {
|
||
|
|
Id int64 `json:"id,string" dc:"id"`
|
||
|
|
Status document.Status `json:"status" dc:"状态"`
|
||
|
|
VectorStatus document.VectorStatus `json:"vectorStatus" dc:"向量状态"`
|
||
|
|
DatasetId int64 `json:"datasetId,string" dc:"所属数据集ID"`
|
||
|
|
DocumentId int64 `json:"documentId,string" dc:"所属文档ID"`
|
||
|
|
Content string `json:"content" dc:"内容"`
|
||
|
|
ContentHash string `json:"contentHash" dc:"内容hash"`
|
||
|
|
ChunkIndex int64 `json:"chunkIndex" dc:"块索引"`
|
||
|
|
Vector []float64 `json:"vector" dc:"向量"`
|
||
|
|
Metadata map[string]interface{} `json:"metadata" dc:"元信息"`
|
||
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||
|
|
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type VectorDocumentChunkMsg struct {
|
||
|
|
TenantId uint64 `json:"tenantId"`
|
||
|
|
Creator string `json:"creator"`
|
||
|
|
DatasetId int64 `json:"datasetId"` // 数据集ID
|
||
|
|
DocumentId int64 `json:"documentId"` // 所属文档ID
|
||
|
|
Content string `json:"content"` // 原始内容
|
||
|
|
ContentHash string `json:"contentHash"` // 原始内容hash
|
||
|
|
ChunkIndex int64 `json:"chunkIndex"` // 第几块
|
||
|
|
Status document.Status `json:"status"`
|
||
|
|
VectorStatus document.VectorStatus `json:"vectorStatus"`
|
||
|
|
Vector pgvector.Vector `json:"vector"`
|
||
|
|
Metadata map[string]interface{} `json:"metadata"`
|
||
|
|
}
|