ai模块修改

This commit is contained in:
2025-12-15 15:26:05 +08:00
parent 3767150fd6
commit 8a03ede7dc
56 changed files with 3403 additions and 1119 deletions

View File

@@ -1,51 +0,0 @@
package org.xyzh.api.agent.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.xyzh.common.dto.BaseDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.databind.JsonNode;
/**
* 知识库DTO
* 用于创建和更新知识库
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "知识库DTO")
public class KnowledgeBaseDTO extends BaseDTO {
private static final long serialVersionUID = 1L;
@Schema(description = "知识库ID更新时需要")
private String knowledgeId;
@Schema(description = "智能体ID")
private String agentId;
@Schema(description = "知识库名称")
private String name;
@Schema(description = "知识库类型bidding-招投标/customer_service-客服/internal-内部协同")
private String kbType;
@Schema(description = "访问级别public-公开/private-私有/internal-内部")
private String accessLevel;
@Schema(description = "知识库描述")
private String description;
@Schema(description = "存储路径")
private String storagePath;
@Schema(description = "当前版本号")
private String version;
@Schema(description = "知识库配置")
private JsonNode config;
@Schema(description = "服务类型")
private String serviceType;
@Schema(description = "状态active-激活/inactive-停用/archived-归档")
private String status;
}

View File

@@ -1,48 +0,0 @@
package org.xyzh.api.agent.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.xyzh.common.dto.BaseDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.databind.JsonNode;
/**
* 知识文档片段DTO
* 用于创建和更新知识文档片段
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "知识文档片段DTO")
public class KnowledgeChunkDTO extends BaseDTO {
private static final long serialVersionUID = 1L;
@Schema(description = "片段ID更新时需要")
private String chunkId;
@Schema(description = "所属文档ID")
private String docId;
@Schema(description = "所属知识库ID")
private String knowledgeId;
@Schema(description = "片段索引")
private Integer chunkIndex;
@Schema(description = "片段内容")
private String content;
@Schema(description = "片段类型text-文本/table-表格/image-图片")
private String chunkType;
@Schema(description = "根chunk ID")
private String rootChunkId;
@Schema(description = "是否当前版本", defaultValue = "true")
private Boolean isCurrent;
@Schema(description = "位置信息")
private JsonNode positionInfo;
@Schema(description = "片段元数据")
private JsonNode metadata;
}

View File

@@ -1,67 +0,0 @@
package org.xyzh.api.agent.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.xyzh.common.dto.BaseDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.List;
/**
* 知识文档DTO
* 用于创建和更新知识文档
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "知识文档DTO")
public class KnowledgeDocumentDTO extends BaseDTO {
private static final long serialVersionUID = 1L;
@Schema(description = "文档ID更新时需要")
private String docId;
@Schema(description = "所属知识库ID")
private String knowledgeId;
@Schema(description = "文档标题")
private String title;
@Schema(description = "文档类型text-文本/pdf/word/excel/image/video")
private String docType;
@Schema(description = "文档分类")
private String category;
@Schema(description = "文档内容(文本类型)")
private String content;
@Schema(description = "关联文件ID")
private String fileId;
@Schema(description = "文件路径")
private String filePath;
@Schema(description = "文件大小")
private Long fileSize;
@Schema(description = "MIME类型")
private String mimeType;
@Schema(description = "根文档ID")
private String rootDocId;
@Schema(description = "文档标签")
private List<String> tags;
@Schema(description = "来源URL")
private String sourceUrl;
@Schema(description = "服务类型")
private String serviceType;
@Schema(description = "文档元数据")
private JsonNode metadata;
@Schema(description = "状态active-激活/inactive-停用/archived-归档")
private String status;
}

View File

@@ -1,93 +0,0 @@
package org.xyzh.api.agent.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.xyzh.common.vo.BaseVO;
import io.swagger.v3.oas.annotations.media.Schema;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.Date;
/**
* 知识库VO
* 用于前端展示知识库信息
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "知识库VO")
public class KnowledgeBaseVO extends BaseVO {
private static final long serialVersionUID = 1L;
@Schema(description = "知识库ID")
private String knowledgeId;
@Schema(description = "智能体ID")
private String agentId;
@Schema(description = "智能体名称")
private String agentName;
@Schema(description = "知识库名称")
private String name;
@Schema(description = "知识库类型")
private String kbType;
@Schema(description = "知识库类型名称")
private String kbTypeName;
@Schema(description = "访问级别")
private String accessLevel;
@Schema(description = "访问级别名称")
private String accessLevelName;
@Schema(description = "知识库描述")
private String description;
@Schema(description = "存储路径")
private String storagePath;
@Schema(description = "当前版本号")
private String version;
@Schema(description = "知识库配置")
private JsonNode config;
@Schema(description = "服务类型")
private String serviceType;
@Schema(description = "部门名称")
private String deptName;
@Schema(description = "状态")
private String status;
@Schema(description = "状态名称")
private String statusName;
@Schema(description = "状态颜色")
private String statusColor;
@Schema(description = "文档总数")
private Long documentCount;
@Schema(description = "已向量化文档数")
private Long embeddedDocCount;
@Schema(description = "chunk总数")
private Long chunkCount;
@Schema(description = "总存储大小(字节)")
private Long totalSize;
@Schema(description = "总存储大小格式化显示")
private String totalSizeFormatted;
@Schema(description = "最后同步时间", format = "date-time")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date lastSyncTime;
@Schema(description = "创建者姓名")
private String creatorName;
}

View File

@@ -1,68 +0,0 @@
package org.xyzh.api.agent.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.xyzh.common.vo.BaseVO;
import io.swagger.v3.oas.annotations.media.Schema;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.Date;
/**
* 知识文档片段VO
* 用于前端展示知识文档片段信息
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "知识文档片段VO")
public class KnowledgeChunkVO extends BaseVO {
private static final long serialVersionUID = 1L;
@Schema(description = "片段ID")
private String chunkId;
@Schema(description = "所属文档ID")
private String docId;
@Schema(description = "文档标题")
private String docTitle;
@Schema(description = "所属知识库ID")
private String knowledgeId;
@Schema(description = "知识库名称")
private String knowledgeName;
@Schema(description = "片段索引")
private Integer chunkIndex;
@Schema(description = "片段内容")
private String content;
@Schema(description = "内容长度")
private Integer contentLength;
@Schema(description = "片段类型")
private String chunkType;
@Schema(description = "片段类型名称")
private String chunkTypeName;
@Schema(description = "版本号")
private Integer version;
@Schema(description = "根chunk ID")
private String rootChunkId;
@Schema(description = "是否当前版本", defaultValue = "false")
private Boolean isCurrent;
@Schema(description = "位置信息")
private JsonNode positionInfo;
@Schema(description = "片段元数据")
private JsonNode metadata;
@Schema(description = "部门名称")
private String deptName;
}

View File

@@ -1,114 +0,0 @@
package org.xyzh.api.agent.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.xyzh.common.vo.BaseVO;
import io.swagger.v3.oas.annotations.media.Schema;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.Date;
import java.util.List;
/**
* 知识文档VO
* 用于前端展示知识文档信息
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "知识文档VO")
public class KnowledgeDocumentVO extends BaseVO {
private static final long serialVersionUID = 1L;
@Schema(description = "文档ID")
private String docId;
@Schema(description = "所属知识库ID")
private String knowledgeId;
@Schema(description = "知识库名称")
private String knowledgeName;
@Schema(description = "文档标题")
private String title;
@Schema(description = "文档类型")
private String docType;
@Schema(description = "文档类型名称")
private String docTypeName;
@Schema(description = "文档分类")
private String category;
@Schema(description = "文档内容")
private String content;
@Schema(description = "内容摘要")
private String contentSummary;
@Schema(description = "关联文件ID")
private String fileId;
@Schema(description = "文件路径")
private String filePath;
@Schema(description = "文件下载URL")
private String fileUrl;
@Schema(description = "文件大小")
private Long fileSize;
@Schema(description = "文件大小格式化显示")
private String fileSizeFormatted;
@Schema(description = "MIME类型")
private String mimeType;
@Schema(description = "版本号")
private Integer version;
@Schema(description = "根文档ID")
private String rootDocId;
@Schema(description = "文档标签")
private List<String> tags;
@Schema(description = "关键词")
private List<String> keywords;
@Schema(description = "向量化状态")
private String embeddingStatus;
@Schema(description = "向量化状态名称")
private String embeddingStatusName;
@Schema(description = "使用的向量化模型")
private String embeddingModel;
@Schema(description = "切片数量")
private Integer chunkCount;
@Schema(description = "文档元数据")
private JsonNode metadata;
@Schema(description = "来源URL")
private String sourceUrl;
@Schema(description = "服务类型")
private String serviceType;
@Schema(description = "部门名称")
private String deptName;
@Schema(description = "状态")
private String status;
@Schema(description = "状态名称")
private String statusName;
@Schema(description = "创建者姓名")
private String creatorName;
@Schema(description = "更新者姓名")
private String updaterName;
}

View File

@@ -9,8 +9,8 @@
<version>1.0.0</version>
</parent>
<groupId>org.xyzh</groupId>
<artifactId>api-agent</artifactId>
<groupId>org.xyzh.apis</groupId>
<artifactId>api-ai</artifactId>
<version>1.0.0</version>
<properties>

View File

@@ -0,0 +1,99 @@
package org.xyzh.api.ai.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;
/**
* @description Dify文件信息用于对话文件上传和请求
* @filename DifyFileInfo.java
* @author AI Assistant
* @copyright xyzh
* @since 2025-12-15
*/
@Data
public class DifyFileInfo {
/**
* 文件IDDify返回
*/
private String id;
/**
* 文件名
*/
private String name;
/**
* 文件大小(字节)
*/
private Integer size;
/**
* 文件扩展名
*/
private String extension;
/**
* 文件MIME类型
*/
@JSONField(name = "mime_type")
private String mimeType;
/**
* 上传人ID
*/
@JSONField(name = "created_by")
private String createdBy;
/**
* 上传时间(时间戳)
*/
@JSONField(name = "created_at")
private Long createdAt;
/**
* 预览URL
*/
@JSONField(name = "preview_url")
private String previewUrl;
/**
* 源文件URL
*/
@JSONField(name = "source_url")
private String sourceUrl;
/**
* 文件类型image、document、audio、video、file
*/
private String type;
/**
* 传输方式remote_url、local_file
*/
@JSONField(name = "transfer_method")
private String transferMethod;
/**
* 文件URL或ID
*/
private String url;
/**
* 本地文件上传ID
*/
@JSONField(name = "upload_file_id")
private String uploadFileId;
/**
* 系统文件ID
*/
@JSONField(name = "sys_file_id")
private String sysFileId;
/**
* 文件路径(从系统文件表获取)
*/
@JSONField(name = "file_path")
private String filePath;
}

View File

@@ -0,0 +1,14 @@
package org.xyzh.api.ai.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "智能体提示卡")
public class PromptCard {
@Schema(description = "文件ID")
private String fileId;
@Schema(description = "提示词")
private String prompt;
}

View File

@@ -0,0 +1,41 @@
package org.xyzh.api.ai.dto;
import java.util.List;
import org.xyzh.common.dto.BaseDTO;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.v3.oas.annotations.media.Schema;
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "系统文件DTO")
public class TbAgent extends BaseDTO{
private static final long serialVersionUID = 1L;
@Schema(description = "智能体ID")
private String agentId;
@Schema(description = "智能体名称")
private String name;
@Schema(description = "智能体描述")
private String description;
@Schema(description = "智能体url")
private String link;
@Schema(description = "智能体APIKEY")
private String apiKey;
@Schema(description = "引导词")
private String introduce;
@Schema(description = "提示卡片数组")
private List<PromptCard> promptCards;
@Schema(description = "分类")
private String category;
}

View File

@@ -0,0 +1,25 @@
package org.xyzh.api.ai.dto;
import org.xyzh.common.dto.BaseDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "AI智能体对话")
public class TbChat extends BaseDTO{
private static final long serialVersionUID = 1L;
@Schema(description = "对话ID")
private String chatId;
@Schema(description = "智能体ID")
private String agentId;
@Schema(description = "用户ID")
private String userId;
@Schema(description = "对话标题")
private String title;
}

View File

@@ -0,0 +1,30 @@
package org.xyzh.api.ai.dto;
import java.util.List;
import org.xyzh.common.dto.BaseDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "AI智能体对话消息")
public class TbChatMessage extends BaseDTO{
private static final long serialVersionUID = 1L;
@Schema(description = "消息ID")
private String messageId;
@Schema(description = "对话ID")
private String chatId;
@Schema(description = "角色")
private String role;
@Schema(description = "内容")
private String content;
@Schema(description = "文件ID数组")
private List<String> files;
}

View File

@@ -0,0 +1,68 @@
package org.xyzh.api.ai.dto;
import org.xyzh.common.dto.BaseDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "知识库配置")
public class TbKnowledge extends BaseDTO{
private static final long serialVersionUID = 1L;
@Schema(description = "知识库ID")
private String knowledgeId;
@Schema(description = "知识库标题")
private String title;
@Schema(description = "知识库头像")
private String avatar;
@Schema(description = "知识库描述")
private String description;
@Schema(description = "Dify知识库IDDataset ID")
private String difyDatasetId;
@Schema(description = "Dify索引方式high_quality/economy")
private String difyIndexingTechnique;
@Schema(description = "向量模型名称")
private String embeddingModel;
@Schema(description = "向量模型提供商")
private String embeddingModelProvider;
@Schema(description = "Rerank模型名称")
private String rerankModel;
@Schema(description = "Rerank模型提供商")
private String rerankModelProvider;
@Schema(description = "是否启用Rerank0否 1是")
private Integer rerankingEnable;
@Schema(description = "检索Top K返回前K个结果")
private Integer retrievalTopK;
@Schema(description = "检索分数阈值0.00-1.00")
private Double retrievalScoreThreshold;
@Schema(description = "文档数量")
private Integer documentCount;
@Schema(description = "总分段数")
private Integer totalChunks;
@Schema(description = "所属服务 workcase、bidding")
private String service;
@Schema(description = "bidding所属项目ID")
private String projectId;
@Schema(description = "所属分类 workcase 内部知识库、外部知识库")
private String category;
}

View File

@@ -0,0 +1,28 @@
package org.xyzh.api.ai.dto;
import org.xyzh.common.dto.BaseDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "知识库文件")
public class TbKnowledgeFile extends BaseDTO{
private final static long serialVersionUID = 1L;
@Schema(description = "知识库ID")
private String knowledgeId;
@Schema(description = "文件ID")
private String fileId;
@Schema(description = "文件根ID")
private String fileRootId;
@Schema(description = "Dify文件ID")
private String difyFileId;
@Schema(description = "文件版本")
private String version;
}

View File

@@ -0,0 +1,12 @@
package org.xyzh.api.ai.vo;
import org.xyzh.common.vo.BaseVO;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
@Data
@Schema(description = "智能体VO")
public class AgentVO extends BaseVO{
}

View File

@@ -22,6 +22,12 @@ public class TbSysFileDTO extends BaseDTO {
@Schema(description = "文件ID (主键)")
private String fileId;
@Schema(description = "文件根ID")
private String fileRootId;
@Schema(description = "文件版本")
private String version;
@Schema(description = "文件名")
private String name;

View File

@@ -21,7 +21,7 @@
<module>api-log</module>
<module>api-system</module>
<module>api-crontab</module>
<module>api-agent</module>
<module>api-ai</module>
<module>api-bidding</module>
<module>api-platform</module>
<module>api-workcase</module>