feat: rag初始版
This commit is contained in:
64
model/entity/document.go
Normal file
64
model/entity/document.go
Normal file
@@ -0,0 +1,64 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"gitea.com/red-future/common/beans"
|
||||
|
||||
"rag/consts/document"
|
||||
)
|
||||
|
||||
type documentCol struct {
|
||||
beans.SQLBaseCol
|
||||
DatasetId string
|
||||
Title string
|
||||
Content string
|
||||
Format string
|
||||
Source string
|
||||
SourceId string
|
||||
Status string
|
||||
VectorStatus string
|
||||
ChunkCount string
|
||||
FileSize string
|
||||
FilePath string
|
||||
Metadata string
|
||||
}
|
||||
|
||||
var DocumentCol = documentCol{
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
DatasetId: "dataset_id",
|
||||
Title: "title",
|
||||
Content: "content",
|
||||
Format: "format",
|
||||
Source: "source",
|
||||
SourceId: "source_id",
|
||||
Status: "status",
|
||||
VectorStatus: "vector_status",
|
||||
ChunkCount: "chunk_count",
|
||||
FileSize: "file_size",
|
||||
FilePath: "file_path",
|
||||
Metadata: "metadata",
|
||||
}
|
||||
|
||||
// Document 文件实体
|
||||
type Document struct {
|
||||
beans.SQLBaseDO `orm:",inline"`
|
||||
|
||||
DatasetId int64 `orm:"dataset_id" json:"datasetId" dc:"数据集ID"`
|
||||
Title string `orm:"title" json:"title" dc:"文件标题"`
|
||||
Content string `orm:"content" json:"content" dc:"文件内容"`
|
||||
Format string `orm:"format" json:"format" dc:"文件格式"`
|
||||
Source string `orm:"source" json:"source" dc:"来源"`
|
||||
SourceId string `orm:"source_id" json:"sourceId" dc:"来源ID"`
|
||||
Status document.Status `orm:"status" json:"status" dc:"状态"`
|
||||
VectorStatus document.VectorStatus `orm:"vector_status" json:"vectorStatus" dc:"向量状态"`
|
||||
ChunkCount int64 `orm:"chunk_count" json:"chunkCount" dc:"切分块数量"`
|
||||
FileSize int64 `orm:"file_size" json:"fileSize" dc:"文件大小"`
|
||||
FilePath string `orm:"file_path" json:"filePath" dc:"文件存储路径"`
|
||||
Metadata *Metadata `orm:"metadata" json:"metadata" dc:"文件元信息"`
|
||||
}
|
||||
|
||||
// Metadata 文件元数据
|
||||
type Metadata struct {
|
||||
Author string `orm:"author" json:"author" dc:"作者"`
|
||||
Tags []string `orm:"tags" json:"tags" dc:"标签"`
|
||||
Custom map[string]string `orm:"custom" json:"custom" dc:"自定义字段"`
|
||||
}
|
||||
Reference in New Issue
Block a user