feat: 新增关键词类型及优化查询逻辑
支持关键词类型区分,优化文件向量查询SQL及DAO更新逻辑,移除冗余配置和注释代码。
This commit is contained in:
@@ -49,6 +49,7 @@ type ListDatasetReq struct {
|
||||
g.Meta `path:"/list" method:"get" tags:"知识库(数据集)管理" summary:"获取知识库(数据集)列表" dc:"分页查询知识库(数据集)列表,支持多条件筛选"`
|
||||
|
||||
Page *beans.Page `json:"page"`
|
||||
Ids []int64 `json:"ids" dc:"数据集ID列表"`
|
||||
Keyword string `json:"keyword" dc:"关键词搜索"`
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,11 @@ type GetDocumentReq struct {
|
||||
Id int64 `json:"id" v:"required#ID不能为空"`
|
||||
}
|
||||
|
||||
type GetDocumentRes struct {
|
||||
*DocumentVO
|
||||
ImgAddressPrefix string `json:"imgAddressPrefix"`
|
||||
}
|
||||
|
||||
// ListDocumentReq 文件列表请求
|
||||
type ListDocumentReq struct {
|
||||
g.Meta `path:"/list" method:"get" tags:"文件管理" summary:"获取文件列表" dc:"分页查询文件列表,支持多条件筛选"`
|
||||
@@ -68,6 +73,8 @@ type DocumentVO struct {
|
||||
Id int64 `json:"id,string" dc:"id"`
|
||||
DatasetId int64 `json:"datasetId,string"`
|
||||
Title string `json:"title" dc:"文件标题"`
|
||||
Format string `orm:"format" json:"format" dc:"文件格式"`
|
||||
FilePath string `orm:"file_path" json:"filePath" dc:"文件存储路径"`
|
||||
Status document.Status `json:"status" dc:"状态1启用/0停用"`
|
||||
VectorStatus document.VectorStatus `json:"vectorStatus" dc:"向量化状态 状态: 1 待定, 2 处理, 3 完成, 4 失败"`
|
||||
ChunkCount int64 `json:"chunkCount" dc:"分块数"`
|
||||
|
||||
@@ -42,6 +42,7 @@ type ListDocumentVectorReq struct {
|
||||
g.Meta `path:"/list" method:"get" tags:"文件块向量管理" summary:"获取文件块向量列表" dc:"分页查询文件块向量列表,支持多条件筛选"`
|
||||
|
||||
Page *beans.Page `json:"page"`
|
||||
Keyword string `json:"keyword" dc:"关键词搜索"`
|
||||
DatasetId int64 `json:"datasetId"`
|
||||
DocumentId int64 `json:"documentId"`
|
||||
Status document.Status `json:"status"`
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"rag/consts/keyword"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
@@ -10,10 +12,11 @@ import (
|
||||
type CreateKeywordReq struct {
|
||||
g.Meta `path:"/create" method:"post" tags:"关键词管理" summary:"创建关键词" dc:"创建关键词"`
|
||||
|
||||
DatasetId int64 `json:"datasetId" v:"required#数据集ID不能为空"`
|
||||
DocumentId int64 `json:"documentId" v:"required#文档ID不能为空"`
|
||||
Word string `json:"word" v:"required#名称不能为空"`
|
||||
Weight int16 `json:"weight" v:"required#权重不能为空"`
|
||||
DatasetId int64 `json:"datasetId" v:"required#数据集ID不能为空"`
|
||||
DocumentId int64 `json:"documentId" v:"required#文档ID不能为空"`
|
||||
Word string `json:"word" v:"required#名称不能为空"`
|
||||
Weight int16 `json:"weight" v:"required#权重不能为空"`
|
||||
KeywordType keyword.KeywordType `json:"keywordType" v:"required#类型不能为空"`
|
||||
}
|
||||
|
||||
// CreateKeywordRes 创建关键词响应
|
||||
@@ -48,12 +51,13 @@ type GetKeywordReq struct {
|
||||
type ListKeywordReq struct {
|
||||
g.Meta `path:"/list" method:"get" tags:"关键词管理" summary:"获取关键词列表" dc:"分页查询关键词列表,支持多条件筛选"`
|
||||
|
||||
Page *beans.Page `json:"page"`
|
||||
DatasetId int64 `json:"datasetId"`
|
||||
DocumentId int64 `json:"documentId"`
|
||||
Word string `json:"word"`
|
||||
Words []string `json:"words"`
|
||||
Keyword string `json:"keyword" dc:"关键词搜索"`
|
||||
Page *beans.Page `json:"page"`
|
||||
DatasetId int64 `json:"datasetId"`
|
||||
DocumentId int64 `json:"documentId"`
|
||||
Word string `json:"word"`
|
||||
Words []string `json:"words"`
|
||||
Keyword string `json:"keyword" dc:"关键词搜索"`
|
||||
KeywordType keyword.KeywordType `json:"keywordType"`
|
||||
}
|
||||
|
||||
// ListKeywordRes 关键词列表响应
|
||||
@@ -63,11 +67,12 @@ type ListKeywordRes struct {
|
||||
}
|
||||
|
||||
type KeywordVO struct {
|
||||
Id int64 `json:"id,string" dc:"id"`
|
||||
Word string `json:"word" dc:"关键词名称"`
|
||||
Weight int16 `json:"weight" dc:"权重"`
|
||||
DatasetId int64 `json:"datasetId,string" dc:"数据集ID"`
|
||||
DocumentId int64 `json:"documentId,string" dc:"文档ID"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||||
Id int64 `json:"id,string" dc:"id"`
|
||||
Word string `json:"word" dc:"关键词名称"`
|
||||
Weight int16 `json:"weight" dc:"权重"`
|
||||
KeywordType keyword.KeywordType `json:"keywordType" dc:"类型"`
|
||||
DatasetId int64 `json:"datasetId,string" dc:"数据集ID"`
|
||||
DocumentId int64 `json:"documentId,string" dc:"文档ID"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||||
}
|
||||
|
||||
@@ -1,27 +1,34 @@
|
||||
package entity
|
||||
|
||||
import "gitea.com/red-future/common/beans"
|
||||
import (
|
||||
"rag/consts/keyword"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
type keywordCol struct {
|
||||
beans.SQLBaseCol
|
||||
DatasetId string
|
||||
DocumentId string
|
||||
Word string
|
||||
Weight string
|
||||
DatasetId string
|
||||
DocumentId string
|
||||
Word string
|
||||
Weight string
|
||||
KeywordType string
|
||||
}
|
||||
|
||||
var KeywordCol = keywordCol{
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
DatasetId: "dataset_id",
|
||||
DocumentId: "document_id",
|
||||
Word: "word",
|
||||
Weight: "weight",
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
DatasetId: "dataset_id",
|
||||
DocumentId: "document_id",
|
||||
Word: "word",
|
||||
Weight: "weight",
|
||||
KeywordType: "keyword_type",
|
||||
}
|
||||
|
||||
type Keyword struct {
|
||||
beans.SQLBaseDO `orm:",inline"`
|
||||
DatasetId int64 `orm:"dataset_id" json:"datasetId" dc:"数据集ID"`
|
||||
DocumentId int64 `orm:"document_id" json:"documentId" dc:"文件ID"`
|
||||
Word string `orm:"word" json:"word" dc:"关键词"`
|
||||
Weight int16 `orm:"weight" json:"weight" dc:"权重"`
|
||||
DatasetId int64 `orm:"dataset_id" json:"datasetId" dc:"数据集ID"`
|
||||
DocumentId int64 `orm:"document_id" json:"documentId" dc:"文件ID"`
|
||||
Word string `orm:"word" json:"word" dc:"关键词"`
|
||||
Weight int16 `orm:"weight" json:"weight" dc:"权重"`
|
||||
KeywordType keyword.KeywordType `orm:"keyword_type" json:"keywordType" dc:"类型"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user