model

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DocSegmentImportInit      = 0 //任务待处理
	DocSegmentImportImporting = 1 //文档分段导入中
	DocSegmentImportSuccess   = 2 //文档分段导入成功
	DocSegmentImportFail      = 3 //文档分段导入失败
)
View Source
const (
	DocWaitingForUpload = -2 //文档待上传
	DocInit             = 0  //文档待处理
	DocSuccess          = 1  //文档处理完成
	DocProcessing       = 3  //文档处理中
	DocFail             = 5  //文档待处理
)
View Source
const (
	MetaTypeString = "string"
	MetaTypeNumber = "number"
	MetaTypeTime   = "time"
)
View Source
const (
	KnowledgeImportAnalyze = 1 //知识库任务解析中
	KnowledgeImportSubmit  = 2 //知识库任务已提交
	KnowledgeImportFinish  = 3 //知识库任务导入完成
	KnowledgeImportError   = 4 //知识库任务导入失败
	FileImportType         = 0 //文件上传
	UrlImportType          = 1 //url上传
	UrlFileImportType      = 2 //2.批量url上传
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddKeywords added in v0.1.4

type AddKeywords struct {
	Id               uint32   `json:"id"`
	UserId           string   `json:"user_id"`
	Action           string   `json:"action"`
	Name             string   `json:"name"`
	Alias            []string `json:"alias"`
	KnowledgeBaseIds []string `json:"knowledge_base_list"`
}

type DocAnalyzer

type DocAnalyzer struct {
	AnalyzerList []string `json:"analyzerList"` //文档解析方式,ocr等
}

type DocImportInfo

type DocImportInfo struct {
	DocInfoList []*DocInfo `json:"docInfoList"`
}

type DocImportMetaData added in v0.1.7

type DocImportMetaData struct {
	DocMetaDataList []*KnowledgeDocMeta `json:"docMetaDataList"`
}

type DocInfo

type DocInfo struct {
	DocId   string `json:"docId"`   //文档id
	DocName string `json:"docName"` //文档名称
	DocUrl  string `json:"docUrl"`  //文档url
	DocType string `json:"docType"` // 文档类型
	DocSize int64  `json:"docSie"`  // 文档大小
}

type DocMetaData added in v0.1.7

type DocMetaData struct {
	MetaId    string      `json:"metaId"`    // 元数据id
	Key       string      `json:"key"`       // key
	Value     interface{} `json:"value"`     // 常量
	ValueType string      `json:"valueType"` // 常量类型
	Rule      string      `json:"rule"`      // 正则表达式
}

type DocPreProcess added in v0.1.7

type DocPreProcess struct {
	PreProcessList []string `json:"preProcessList"` //文档预处理方式: replace_symbols, delete_links
}

type DocSegmentImportParams added in v0.2.1

type DocSegmentImportParams struct {
	KnowledgeName   string `json:"knowledgeName"`   // 知识库的名称
	KnowledgeId     string `json:"knowledgeId"`     // 知识库的唯一ID
	FileName        string `json:"fileName"`        // 与chunk关联的文件名
	MaxSentenceSize int    `json:"maxSentenceSize"` // 最大分段长度限制
	FileUrl         string `json:"fileUrl"`         //文件url
}

type DocSegmentImportTask added in v0.2.1

type DocSegmentImportTask struct {
	Id           uint32 `gorm:"column:id;primary_key;type:bigint(20) auto_increment;not null;comment:'id';" json:"id"`
	ImportId     string `gorm:"uniqueIndex:idx_unique_import_id;column:import_id;type:varchar(64)" json:"importId"` // Business Primary Key
	DocId        string `gorm:"column:doc_id;type:varchar(64);not null;index:idx_doc_id" json:"docId"`
	Status       int    `` /* 142-byte string literal not displayed */
	SuccessCount int    `gorm:"column:success_count;type:bigint(20);default:0;comment:'成功数量'" json:"successCount"`
	TotalCount   int    `` /* 143-byte string literal not displayed */
	ErrorMsg     string `gorm:"column:error_msg;type:longtext;not null;comment:'解析的错误信息'" json:"errorMsg"`
	ImportParams string `gorm:"column:import_params;type:text;not null;comment:'导入信息'" json:"importParams"`
	CreatedAt    int64  `gorm:"column:create_at;type:bigint(20);not null;autoCreateTime:milli" json:"createAt"` // Create Time
	UpdatedAt    int64  `gorm:"column:update_at;type:bigint(20);not null;autoUpdateTime:milli" json:"updateAt"` // Update Time
	UserId       string `gorm:"column:user_id;type:varchar(64);not null;default:'';" json:"userId"`
	OrgId        string `gorm:"column:org_id;type:varchar(64);not null;default:''" json:"orgId"`
}

func (DocSegmentImportTask) TableName added in v0.2.1

func (DocSegmentImportTask) TableName() string

type KnowledgeBase

type KnowledgeBase struct {
	Id             uint32 `gorm:"column:id;primary_key;type:bigint(20) auto_increment;not null;comment:'id';" json:"id"`       // Primary Key
	KnowledgeId    string `gorm:"uniqueIndex:idx_unique_knowledge_id;column:knowledge_id;type:varchar(64)" json:"knowledgeId"` // Business Primary Key
	Name           string `gorm:"column:name;index:idx_user_id_name,priority:2;type:varchar(256);not null;default:''" json:"name"`
	Description    string `gorm:"column:description;type:text;comment:'知识库描述';" json:"description"`
	DocCount       int    `gorm:"column:doc_count;type:int(11);not null;default:0;comment:'文档数量';" json:"docCount"`
	DocSize        int64  `gorm:"column:doc_size;type:bigint(20);not null;default:0;comment:'文档大小单位:字节';" json:"docSize"`
	EmbeddingModel string `gorm:"column:embedding_model;type:longtext;not null;comment:'embedding模型信息';" json:"embeddingModel"`
	CreatedAt      int64  `gorm:"column:create_at;type:bigint(20);not null;" json:"createAt"` // Create Time
	UpdatedAt      int64  `gorm:"column:update_at;type:bigint(20);not null;" json:"updateAt"` // Update Time
	UserId         string `gorm:"column:user_id;index:idx_user_id_name,priority:1;type:varchar(64);not null;default:'';" json:"userId"`
	OrgId          string `gorm:"column:org_id;type:varchar(64);not null;default:'';" json:"orgId"`
	Deleted        int    `gorm:"column:deleted;type:tinyint(1);not null;default:0;comment:'是否逻辑删除';" json:"deleted"`
}

func (KnowledgeBase) TableName

func (KnowledgeBase) TableName() string

type KnowledgeDoc

type KnowledgeDoc struct {
	Id           uint32 `json:"id" gorm:"primary_key;type:bigint(20) auto_increment;not null;comment:'id';"` // Primary Key
	DocId        string `gorm:"uniqueIndex:idx_unique_doc_id;column:doc_id;type:varchar(64)" json:"docId"`   // Business Primary Key
	ImportTaskId string `gorm:"column:batch_id;type:varchar(64);not null;default:'';comment:'导入的任务id'" json:"importTaskId"`
	KnowledgeId  string `` /* 175-byte string literal not displayed */
	FilePathMd5  string `gorm:"column:file_path_md5;type:varchar(64);not null;default:'';comment:'文件的md5值'" json:"filePathMd5"`
	FilePath     string `gorm:"column:file_path;type:text;not null" json:"filePath"`
	Name         string `gorm:"column:name;index:idx_user_id_knowledge_id_name,priority:3;type:varchar(256);not null;default:''" json:"name"`
	FileType     string `gorm:"column:file_type;type:varchar(20);not null;default:''" json:"fileType"`
	FileSize     int64  `gorm:"column:file_size;type:bigint(20);COMMENT:'文件大小,单位byte'" json:"fileSize"`
	Status       int    `` /* 211-byte string literal not displayed */
	ErrorMsg     string `gorm:"column:error_msg;type:longtext;not null;comment:'解析的错误信息'" json:"errorMsg"`
	CreatedAt    int64  `gorm:"column:create_at;type:bigint(20);not null;" json:"createAt"` // Create Time
	UpdatedAt    int64  `gorm:"column:update_at;type:bigint(20);not null;" json:"updateAt"` // Update Time
	UserId       string ``                                                                  /* 166-byte string literal not displayed */
	OrgId        string `gorm:"column:org_id;type:varchar(64);not null;default:''" json:"orgId"`
	Deleted      int    `gorm:"column:deleted;type:tinyint(1);not null;default:0;comment:'是否逻辑删除';" json:"deleted"`
}

func (KnowledgeDoc) TableName

func (KnowledgeDoc) TableName() string

type KnowledgeDocMeta added in v0.1.6

type KnowledgeDocMeta struct {
	Id        uint32 `json:"id" gorm:"primary_key;type:bigint(20) auto_increment;not null;comment:'id';"`  // Primary Key
	MetaId    string `gorm:"uniqueIndex:idx_unique_meta_id;column:meta_id;type:varchar(64)" json:"metaId"` // Business Primary Key
	DocId     string `gorm:"index:idx_doc_id;column:doc_id;type:varchar(64)" json:"docId"`                 // Business Primary Key
	Key       string `gorm:"column:key;type:varchar(64);not null;default:''" json:"key"`
	Value     string `gorm:"column:value;type:text;not null;" json:"value"`
	ValueType string `gorm:"column:value_type;type:varchar(64);not null;default:'string';comment:'string,number,time'" json:"valueType"`
	Rule      string `gorm:"column:rule;type:text;not null;" json:"rule"`
	CreatedAt int64  `gorm:"column:create_at;type:bigint(20);not null;" json:"createAt"` // Create Time
	UpdatedAt int64  `gorm:"column:update_at;type:bigint(20);not null;" json:"updateAt"` // Update Time
	UserId    string ``                                                                  /* 166-byte string literal not displayed */
	OrgId     string `gorm:"column:org_id;type:varchar(64);not null;default:''" json:"orgId"`
}

func (KnowledgeDocMeta) TableName added in v0.1.6

func (KnowledgeDocMeta) TableName() string

type KnowledgeImportTask

type KnowledgeImportTask struct {
	Id            uint32 `gorm:"column:id;primary_key;type:bigint(20) auto_increment;not null;comment:'id';" json:"id"`
	ImportId      string `gorm:"uniqueIndex:idx_unique_import_id;column:import_id;type:varchar(64)" json:"importId"` // Business Primary Key
	KnowledgeId   string `gorm:"column:knowledge_id;type:varchar(64);not null;index:idx_knowledge_id" json:"knowledgeId"`
	ImportType    int    `gorm:"column:import_type;type:tinyint(1);not null;" json:"importType"`
	Status        int    `` /* 170-byte string literal not displayed */
	ErrorMsg      string `gorm:"column:error_msg;type:longtext;not null;comment:'解析的错误信息'" json:"errorMsg"`
	DocInfo       string `gorm:"column:doc_info;type:longtext;not null;comment:'文件信息'" json:"docInfo"`
	SegmentConfig string `gorm:"column:segment_config;type:text;not null;comment:'分段配置信息'" json:"segmentConfig"`
	DocAnalyzer   string `gorm:"column:doc_analyzer;type:text;not null;comment:'文档解析配置'" json:"docAnalyzer"`
	OcrModelId    string `gorm:"column:ocr_model_id;type:varchar(64);not null;default:'';comment:'ocr模型id'" json:"ocrModelId"`
	DocPreProcess string `` /* 131-byte string literal not displayed */
	MetaData      string `gorm:"column:meta_data;type:text;not null;comment:'元数据列表'" json:"metaData"`
	CreatedAt     int64  `gorm:"column:create_at;type:bigint(20);not null;" json:"createAt"` // Create Time
	UpdatedAt     int64  `gorm:"column:update_at;type:bigint(20);not null;" json:"updateAt"` // Update Time
	UserId        string `gorm:"column:user_id;type:varchar(64);not null;default:'';" json:"userId"`
	OrgId         string `gorm:"column:org_id;type:varchar(64);not null;default:''" json:"orgId"`
}

func (KnowledgeImportTask) TableName

func (KnowledgeImportTask) TableName() string

type KnowledgeKeywords added in v0.1.4

type KnowledgeKeywords struct {
	Id               uint32 `json:"id" gorm:"primary_key;type:bigint(20) auto_increment;not null;comment:'id';"` // Primary Key
	Name             string `json:"name" gorm:"column:name;type:varchar(255);comment:专名词"`
	Alias            string `json:"alias" gorm:"column:alias;type:varchar(255);comment:别名"`
	KnowledgeBaseIds string `json:"knowledgeBaseIds" gorm:"column:knowledge_base_ids;type:text;comment:关联的知识库id;内容格式为:[\"2\",\"3\"]"`
	UserId           string `json:"userId" gorm:"column:user_id;type:varchar(64);not null;index:idx_user_id;comment:用户id;default:''"`
	OrgId            string `json:"orgId" gorm:"column:org_id;type:varchar(64);not null;default:''"`
	CreatedAt        int64  `gorm:"autoCreateTime:milli;index:created_at;column:created_at;type:bigint" json:"createdAt"`
	UpdatedAt        int64  `gorm:"autoUpdateTime:milli;column:updated_at;type:bigint" json:"updatedAt"`
}

KnowledgeKeywords 知识库关键词映射表

func (KnowledgeKeywords) TableName added in v0.1.4

func (KnowledgeKeywords) TableName() string

type KnowledgeSplitter added in v0.1.6

type KnowledgeSplitter struct {
	Id         uint32 `gorm:"column:id;primary_key;type:bigint(20) auto_increment;not null;comment:'id';" json:"id"`    // Primary Key
	SplitterId string `gorm:"uniqueIndex:idx_unique_splitter_id;column:splitter_id;type:varchar(64)" json:"splitterId"` // Business Primary Key
	Name       string `gorm:"column:name;index:idx_user_id_name,priority:2;type:varchar(64);not null;default:''" json:"name"`
	Value      string `gorm:"column:value;type:varchar(64);not null;default:''" json:"value"`
	CreatedAt  int64  `gorm:"column:create_at;type:bigint(20);not null;" json:"createAt"` // Create Time
	UpdatedAt  int64  `gorm:"column:update_at;type:bigint(20);not null;" json:"updateAt"` // Update Time
	UserId     string `gorm:"column:user_id;index:idx_user_id_name,priority:1;type:varchar(64);not null;default:'';" json:"userId"`
	OrgId      string `gorm:"column:org_id;type:varchar(64);not null;default:'';" json:"orgId"`
}

func (KnowledgeSplitter) TableName added in v0.1.6

func (KnowledgeSplitter) TableName() string

type KnowledgeTag added in v0.1.3

type KnowledgeTag struct {
	Id        uint32 `gorm:"column:id;primary_key;type:bigint(20) auto_increment;not null;comment:'id';" json:"id"` // Primary Key
	TagId     string `gorm:"uniqueIndex:idx_unique_tag_id;column:tag_id;type:varchar(64)" json:"tagId"`             // Business Primary Key
	Name      string `gorm:"column:name;index:idx_user_id_name,priority:2;type:varchar(64);not null;default:''" json:"name"`
	CreatedAt int64  `gorm:"column:create_at;type:bigint(20);not null;" json:"createAt"` // Create Time
	UpdatedAt int64  `gorm:"column:update_at;type:bigint(20);not null;" json:"updateAt"` // Update Time
	UserId    string `gorm:"column:user_id;index:idx_user_id_name,priority:1;type:varchar(64);not null;default:'';" json:"userId"`
	OrgId     string `gorm:"column:org_id;type:varchar(64);not null;default:'';" json:"orgId"`
}

func (KnowledgeTag) TableName added in v0.1.3

func (KnowledgeTag) TableName() string

type KnowledgeTagRelation added in v0.1.3

type KnowledgeTagRelation struct {
	Id          uint32 `gorm:"column:id;primary_key;type:bigint(20) auto_increment;not null;comment:'id';" json:"id"`               // Primary Key
	TagId       string `gorm:"column:tag_id;index:idx_tag_id;type:varchar(64);not null;default:'';" json:"tagId"`                   // tagId
	KnowledgeId string `gorm:"column:knowledge_id;index:idx_knowledge_id;type:varchar(64);not null;default:'';" json:"knowledgeId"` // knowledgeId
	CreatedAt   int64  `gorm:"column:create_at;type:bigint(20);not null;" json:"createAt"`                                          // Create Time
	UpdatedAt   int64  `gorm:"column:update_at;type:bigint(20);not null;" json:"updateAt"`                                          // Update Time
	UserId      string `gorm:"column:user_id;index:idx_user_id_tag_name,priority:1;type:varchar(64);not null;default:'';" json:"userId"`
	OrgId       string `gorm:"column:org_id;type:varchar(64);not null;default:'';" json:"orgId"`
}

func (KnowledgeTagRelation) TableName added in v0.1.3

func (KnowledgeTagRelation) TableName() string

type SegmentConfig

type SegmentConfig struct {
	SegmentType string   `json:"segmentType" validate:"required"` //分段方式 0:自定分段;1:自定义分段
	Splitter    []string `json:"splitter"`                        // 分隔符(只有自定义分段必填)
	MaxSplitter int      `json:"maxSplitter"`                     // 可分隔最大值(只有自定义分段必填)
	Overlap     float32  `json:"overlap"`                         // 可重叠值(只有自定义分段必填)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL