package com.lingyue.graph.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lingyue.common.domain.entity.SimpleModel;
import com.lingyue.common.mybatis.PostgreSqlVectorTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 向量嵌入实体
 * 存储文本块的向量表示，用于相似度检索
 *
 * @author lingyue
 * @since 2026-01-15
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName(value = "vector_embeddings", autoResultMap = true)
@Schema(description = "向量嵌入实体")
public class VectorEmbedding extends SimpleModel {

    @Schema(description = "关联的文本分块ID")
    @TableField("chunk_id")
    private String chunkId;

    @Schema(description = "向量嵌入（pgvector格式字符串）")
    @TableField(value = "embedding", typeHandler = PostgreSqlVectorTypeHandler.class)
    private String embedding;

    @Schema(description = "使用的嵌入模型名称")
    @TableField("model_name")
    private String modelName = "nomic-embed-text";
}
