本地 RAG 知识库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

138 lines
3.1 KiB

package com.wok.supportbot.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.wok.supportbot.handler.PostgresJsonTypeHandler;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
/**
* 知识文档表 - 记录上传的文档元信息
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "knowledge_document", autoResultMap = true)
public class KnowledgeDocument implements Serializable {
@Serial
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 文档标题
*/
@TableField("title")
private String title;
/**
* 原始文件名
*/
@TableField("source_name")
private String sourceName;
/**
* 文件类型 - pdf/md/json/txt/word/excel 等
*/
@TableField("file_type")
private String fileType;
/**
* 文件大小(字节)
*/
@TableField("file_size")
private Long fileSize;
/**
* 原始文件存储路径(相对路径)
*/
@TableField("file_path")
private String filePath;
/**
* 原文内容(截断预览)
*/
@TableField("content")
private String content;
/**
* 所属分类ID - 0表示未分类
*/
@TableField("category_id")
@JsonSerialize(using = ToStringSerializer.class)
private Long categoryId;
/**
* 标签列表(JSON数组)
*/
@TableField(value = "tags", typeHandler = PostgresJsonTypeHandler.class)
private Map<String, Object> tags;
/**
* 分块数量
*/
@TableField("chunk_count")
private Integer chunkCount;
/**
* 处理状态 - PROCESSING/READY/FAILED
*/
@TableField("status")
private String status;
/**
* 处理失败时的错误信息
*/
@TableField("error_message")
private String errorMessage;
/**
* 内容哈希值(SHA-256),用于文档去重
*/
@TableField("content_hash")
private String contentHash;
/**
* 是否启用 - true:启用(参与RAG检索), false:禁用(不参与检索但保留数据)
*/
@TableField("enabled")
private Boolean enabled;
/**
* 分块参数配置(JSONB),存储 per-doc 的 chunkSize/overlap 等
*/
@TableField(value = "extra_config", typeHandler = PostgresJsonTypeHandler.class)
private Map<String, Object> extraConfig;
/**
* 创建时间
*/
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
/**
* 更新时间
*/
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
/**
* 删除标志 - false:未删除, true:已删除(逻辑删除)
*/
@TableField("is_delete")
@TableLogic
private boolean isDelete;
}