feat: manually mirror opencoze's code from bytedance
Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
This commit is contained in:
32
backend/domain/knowledge/internal/dal/model/knowledge.gen.go
Normal file
32
backend/domain/knowledge/internal/dal/model/knowledge.gen.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameKnowledge = "knowledge"
|
||||
|
||||
// Knowledge 知识库表
|
||||
type Knowledge struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;comment:主键ID" json:"id"` // 主键ID
|
||||
Name string `gorm:"column:name;not null;comment:名称" json:"name"` // 名称
|
||||
AppID int64 `gorm:"column:app_id;not null;comment:项目ID,标识该资源是否是项目独有" json:"app_id"` // 项目ID,标识该资源是否是项目独有
|
||||
CreatorID int64 `gorm:"column:creator_id;not null;comment:ID" json:"creator_id"` // ID
|
||||
SpaceID int64 `gorm:"column:space_id;not null;comment:空间ID" json:"space_id"` // 空间ID
|
||||
CreatedAt int64 `gorm:"column:created_at;not null;comment:Create Time in Milliseconds" json:"created_at"` // Create Time in Milliseconds
|
||||
UpdatedAt int64 `gorm:"column:updated_at;not null;comment:Update Time in Milliseconds" json:"updated_at"` // Update Time in Milliseconds
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:Delete Time in Milliseconds" json:"deleted_at"` // Delete Time in Milliseconds
|
||||
Status int32 `gorm:"column:status;not null;default:1;comment:0 初始化, 1 生效 2 失效" json:"status"` // 0 初始化, 1 生效 2 失效
|
||||
Description string `gorm:"column:description;comment:描述" json:"description"` // 描述
|
||||
IconURI string `gorm:"column:icon_uri;comment:头像uri" json:"icon_uri"` // 头像uri
|
||||
FormatType int32 `gorm:"column:format_type;not null;comment:0:文本 1:表格 2:图片" json:"format_type"` // 0:文本 1:表格 2:图片
|
||||
}
|
||||
|
||||
// TableName Knowledge's table name
|
||||
func (*Knowledge) TableName() string {
|
||||
return TableNameKnowledge
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/coze-dev/coze-studio/backend/domain/knowledge/entity"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameKnowledgeDocument = "knowledge_document"
|
||||
|
||||
// KnowledgeDocument 知识库文档表
|
||||
type KnowledgeDocument struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;comment:主键ID" json:"id"` // 主键ID
|
||||
KnowledgeID int64 `gorm:"column:knowledge_id;not null;comment:所属knowledge的ID" json:"knowledge_id"` // 所属knowledge的ID
|
||||
Name string `gorm:"column:name;not null;comment:文档名称" json:"name"` // 文档名称
|
||||
FileExtension string `gorm:"column:file_extension;not null;default:0;comment:文档类型, txt/pdf/csv/..." json:"file_extension"` // 文档类型, txt/pdf/csv/...
|
||||
DocumentType int32 `gorm:"column:document_type;not null;comment:文档类型: 0:文本 1:表格 2:图片" json:"document_type"` // 文档类型: 0:文本 1:表格 2:图片
|
||||
URI string `gorm:"column:uri;comment:资源uri" json:"uri"` // 资源uri
|
||||
Size int64 `gorm:"column:size;not null;comment:文档大小" json:"size"` // 文档大小
|
||||
SliceCount int64 `gorm:"column:slice_count;not null;comment:分片数量" json:"slice_count"` // 分片数量
|
||||
CharCount int64 `gorm:"column:char_count;not null;comment:字符数" json:"char_count"` // 字符数
|
||||
CreatorID int64 `gorm:"column:creator_id;not null;comment:创建者ID" json:"creator_id"` // 创建者ID
|
||||
SpaceID int64 `gorm:"column:space_id;not null;comment:空间id" json:"space_id"` // 空间id
|
||||
CreatedAt int64 `gorm:"column:created_at;not null;comment:Create Time in Milliseconds" json:"created_at"` // Create Time in Milliseconds
|
||||
UpdatedAt int64 `gorm:"column:updated_at;not null;comment:Update Time in Milliseconds" json:"updated_at"` // Update Time in Milliseconds
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:Delete Time in Milliseconds" json:"deleted_at"` // Delete Time in Milliseconds
|
||||
SourceType int32 `gorm:"column:source_type;not null;comment:0:本地文件上传, 2:自定义文本" json:"source_type"` // 0:本地文件上传, 2:自定义文本
|
||||
Status int32 `gorm:"column:status;not null;comment:状态" json:"status"` // 状态
|
||||
FailReason string `gorm:"column:fail_reason;comment:失败原因" json:"fail_reason"` // 失败原因
|
||||
ParseRule *DocumentParseRule `gorm:"column:parse_rule;comment:解析+切片规则;serializer:json" json:"parse_rule"` // 解析+切片规则
|
||||
TableInfo *entity.TableInfo `gorm:"column:table_info;comment:表格信息;serializer:json" json:"table_info"` // 表格信息
|
||||
}
|
||||
|
||||
// TableName KnowledgeDocument's table name
|
||||
func (*KnowledgeDocument) TableName() string {
|
||||
return TableNameKnowledgeDocument
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameKnowledgeDocumentReview = "knowledge_document_review"
|
||||
|
||||
// KnowledgeDocumentReview 文档审阅表
|
||||
type KnowledgeDocumentReview struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;comment:主键ID" json:"id"` // 主键ID
|
||||
KnowledgeID int64 `gorm:"column:knowledge_id;not null;comment:knowledge id" json:"knowledge_id"` // knowledge id
|
||||
SpaceID int64 `gorm:"column:space_id;not null;comment:空间id" json:"space_id"` // 空间id
|
||||
Name string `gorm:"column:name;not null;comment:文档名称" json:"name"` // 文档名称
|
||||
Type string `gorm:"column:type;not null;default:0;comment:文档类型" json:"type"` // 文档类型
|
||||
URI string `gorm:"column:uri;comment:资源标识" json:"uri"` // 资源标识
|
||||
FormatType int32 `gorm:"column:format_type;not null;comment:0 文本, 1 表格, 2 图片" json:"format_type"` // 0 文本, 1 表格, 2 图片
|
||||
Status int32 `gorm:"column:status;not null;comment:0 处理中,1 已完成,2 失败,3 失效" json:"status"` // 0 处理中,1 已完成,2 失败,3 失效
|
||||
ChunkRespURI string `gorm:"column:chunk_resp_uri;comment:预切片tos资源标识" json:"chunk_resp_uri"` // 预切片tos资源标识
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:Delete Time in Milliseconds" json:"deleted_at"` // Delete Time in Milliseconds
|
||||
CreatedAt int64 `gorm:"column:created_at;not null;comment:Create Time in Milliseconds" json:"created_at"` // Create Time in Milliseconds
|
||||
UpdatedAt int64 `gorm:"column:updated_at;not null;comment:Update Time in Milliseconds" json:"updated_at"` // Update Time in Milliseconds
|
||||
CreatorID int64 `gorm:"column:creator_id;not null;comment:创建者ID" json:"creator_id"` // 创建者ID
|
||||
}
|
||||
|
||||
// TableName KnowledgeDocumentReview's table name
|
||||
func (*KnowledgeDocumentReview) TableName() string {
|
||||
return TableNameKnowledgeDocumentReview
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameKnowledgeDocumentSlice = "knowledge_document_slice"
|
||||
|
||||
// KnowledgeDocumentSlice 知识库文件切片表
|
||||
type KnowledgeDocumentSlice struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;comment:主键ID" json:"id"` // 主键ID
|
||||
KnowledgeID int64 `gorm:"column:knowledge_id;not null;comment:knowledge id" json:"knowledge_id"` // knowledge id
|
||||
DocumentID int64 `gorm:"column:document_id;not null;comment:document id" json:"document_id"` // document id
|
||||
Content string `gorm:"column:content;comment:切片内容" json:"content"` // 切片内容
|
||||
Sequence float64 `gorm:"column:sequence;not null;type:decimal(20,5);comment:切片顺序号, 从1开始" json:"sequence"` // 切片顺序号, 从1开始
|
||||
CreatedAt int64 `gorm:"column:created_at;not null;comment:Create Time in Milliseconds" json:"created_at"` // Create Time in Milliseconds
|
||||
UpdatedAt int64 `gorm:"column:updated_at;not null;comment:Update Time in Milliseconds" json:"updated_at"` // Update Time in Milliseconds
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:Delete Time in Milliseconds" json:"deleted_at"` // Delete Time in Milliseconds
|
||||
CreatorID int64 `gorm:"column:creator_id;not null;comment:创建者ID" json:"creator_id"` // 创建者ID
|
||||
SpaceID int64 `gorm:"column:space_id;not null;comment:空间ID" json:"space_id"` // 空间ID
|
||||
Status int32 `gorm:"column:status;not null;comment:状态" json:"status"` // 状态
|
||||
FailReason string `gorm:"column:fail_reason;comment:失败原因" json:"fail_reason"` // 失败原因
|
||||
Hit int64 `gorm:"column:hit;not null;comment:命中次数" json:"hit"` // 命中次数
|
||||
}
|
||||
|
||||
// TableName KnowledgeDocumentSlice's table name
|
||||
func (*KnowledgeDocumentSlice) TableName() string {
|
||||
return TableNameKnowledgeDocumentSlice
|
||||
}
|
||||
14
backend/domain/knowledge/internal/dal/model/progress.go
Normal file
14
backend/domain/knowledge/internal/dal/model/progress.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package model
|
||||
|
||||
type SliceStatus int32
|
||||
|
||||
const (
|
||||
SliceStatusProcessing SliceStatus = 0
|
||||
SliceStatusDone SliceStatus = 1
|
||||
SliceStatusFailed SliceStatus = 2
|
||||
)
|
||||
|
||||
type SliceProgress struct {
|
||||
Status SliceStatus
|
||||
StatusMsg string
|
||||
}
|
||||
8
backend/domain/knowledge/internal/dal/model/strategy.go
Normal file
8
backend/domain/knowledge/internal/dal/model/strategy.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package model
|
||||
|
||||
import "github.com/coze-dev/coze-studio/backend/domain/knowledge/entity"
|
||||
|
||||
type DocumentParseRule struct {
|
||||
ParsingStrategy *entity.ParsingStrategy `json:"parsing_strategy"`
|
||||
ChunkingStrategy *entity.ChunkingStrategy `json:"chunking_strategy"`
|
||||
}
|
||||
Reference in New Issue
Block a user