refactor(ai): 合并ai_document表到vector_store表,切换文档ID类型为字符串
- 删除旧的ai_document表及相关索引,新增vector_store表兼容Spring AI PgVectorStore结构 - 调整实体类AiDocument映射到vector_store表,使用字符串ID代替Long类型 - 修改Mapper接口及XML中所有ID相关SQL使用字符串类型,并替换表名为vector_store - 修改服务接口与实现类,文档ID参数类型统一为字符串 - 处理文档分块时改用UUID生成chunk ID,确保唯一且格式正确 - 禁用Spring Ai PgVectorStore的自动schema初始化,使用手动创建的表结构 - 更新配置文件OpenAI模型API key及基础URL配置,支持多模型与聊天功能 - 优化日志输出,增加分块文档ID和父文档ID显示,方便调试追踪
This commit is contained in:
@@ -9,20 +9,20 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* AI文档向量实体
|
||||
* 对应 ai_document 表
|
||||
* 向量存储实体
|
||||
* 对应 vector_store 表
|
||||
* 兼容 Spring AI PgVectorStore 默认结构
|
||||
*/
|
||||
@Data
|
||||
@TableName("ai_document")
|
||||
@TableName("vector_store")
|
||||
public class AiDocument {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文档唯一标识(UUID)
|
||||
* 文档ID(字符串类型,兼容PgVectorStore)
|
||||
* 使用标准UUID格式(带连字符)
|
||||
*/
|
||||
private String docId;
|
||||
@TableId(type = IdType.INPUT)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 关联项目ID
|
||||
@@ -124,7 +124,7 @@ public class AiDocument {
|
||||
/**
|
||||
* 父文档ID(分块时使用)
|
||||
*/
|
||||
private Long chunkParentId;
|
||||
private String chunkParentId;
|
||||
|
||||
/**
|
||||
* 标签数组(JSON)
|
||||
|
||||
Reference in New Issue
Block a user