mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-04-06 00:07:34 +00:00
Merge branch 'main' into main
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
@@ -106,7 +106,6 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.langchain4j</groupId>
|
||||
<artifactId>langchain4j-community-dashscope</artifactId>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.ruoyi.domain;
|
||||
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@@ -85,7 +84,7 @@ public class ChatModel extends BaseEntity {
|
||||
/**
|
||||
* 模型供应商
|
||||
*/
|
||||
private String ProviderName;
|
||||
private String providerName;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.ruoyi.domain;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -26,13 +26,13 @@ public class ChatToken implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@NotBlank(message = "用户ID", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "用户ID", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long UserId;
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ public class ChatToken implements Serializable {
|
||||
/**
|
||||
* 模型名称
|
||||
*/
|
||||
@NotBlank(message = "模型名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "模型名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String modelName;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,11 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.annotation.DataColumn;
|
||||
import org.ruoyi.core.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* MCP对象 mcp_info
|
||||
*
|
||||
@@ -25,7 +22,7 @@ public class McpInfo extends BaseEntity {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "mcp_id", type = IdType.AUTO)
|
||||
@TableId(value = "mcp_id", type = IdType.AUTO)
|
||||
private Integer mcpId;
|
||||
|
||||
/**
|
||||
@@ -62,6 +59,4 @@ public class McpInfo extends BaseEntity {
|
||||
private Boolean status;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -24,55 +24,55 @@ public class ChatMessageBo extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@NotNull(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "用户id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
@NotBlank(message = "消息内容不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "消息内容不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 会话id
|
||||
*/
|
||||
@NotBlank(message = "会话id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "会话id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long sessionId;
|
||||
|
||||
/**
|
||||
* 对话角色
|
||||
*/
|
||||
@NotBlank(message = "对话角色不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "对话角色不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String role;
|
||||
|
||||
/**
|
||||
* 扣除金额
|
||||
*/
|
||||
@NotNull(message = "扣除金额不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "扣除金额不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Double deductCost;
|
||||
|
||||
/**
|
||||
* 累计 Tokens
|
||||
*/
|
||||
@NotNull(message = "累计 Tokens不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "累计 Tokens不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Integer totalTokens;
|
||||
|
||||
/**
|
||||
* 模型名称
|
||||
*/
|
||||
@NotBlank(message = "模型名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "模型名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String modelName;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotBlank(message = "备注不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "备注不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
package org.ruoyi.domain.bo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.common.core.validate.AddGroup;
|
||||
import org.ruoyi.common.core.validate.EditGroup;
|
||||
import org.ruoyi.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
@@ -29,19 +23,19 @@ public class ChatMessageForUniappBo implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@NotNull(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "用户id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
@NotBlank(message = "消息内容不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "消息内容不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String content;
|
||||
|
||||
/**
|
||||
@@ -67,7 +61,7 @@ public class ChatMessageForUniappBo implements Serializable {
|
||||
/**
|
||||
* 模型名称
|
||||
*/
|
||||
private String modelName ;
|
||||
private String modelName;
|
||||
|
||||
|
||||
/**
|
||||
@@ -112,5 +106,4 @@ public class ChatMessageForUniappBo implements Serializable {
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.ruoyi.domain.bo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
@@ -25,43 +24,43 @@ public class ChatModelBo extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 模型分类
|
||||
*/
|
||||
@NotBlank(message = "模型分类不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "模型分类不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 模型名称
|
||||
*/
|
||||
@NotBlank(message = "模型名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "模型名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String modelName;
|
||||
|
||||
/**
|
||||
* 模型描述
|
||||
*/
|
||||
@NotBlank(message = "模型描述不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "模型描述不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String modelDescribe;
|
||||
|
||||
/**
|
||||
* 模型价格
|
||||
*/
|
||||
@NotNull(message = "模型价格不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "模型价格不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Double modelPrice;
|
||||
|
||||
/**
|
||||
* 计费类型
|
||||
*/
|
||||
@NotBlank(message = "计费类型不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "计费类型不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String modelType;
|
||||
|
||||
/**
|
||||
* 是否显示
|
||||
*/
|
||||
@NotBlank(message = "是否显示不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "是否显示不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String modelShow;
|
||||
|
||||
/**
|
||||
@@ -72,7 +71,7 @@ public class ChatModelBo extends BaseEntity {
|
||||
/**
|
||||
* 请求地址
|
||||
*/
|
||||
@NotBlank(message = "请求地址不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "请求地址不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String apiHost;
|
||||
|
||||
/**
|
||||
@@ -83,18 +82,18 @@ public class ChatModelBo extends BaseEntity {
|
||||
/**
|
||||
* 密钥
|
||||
*/
|
||||
@NotBlank(message = "密钥不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "密钥不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String apiKey;
|
||||
|
||||
/**
|
||||
* 模型供应商
|
||||
*/
|
||||
private String ProviderName;
|
||||
private String providerName;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotBlank(message = "备注不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "备注不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
@@ -26,49 +26,49 @@ public class ChatPayOrderBo extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
@NotBlank(message = "订单编号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "订单编号不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 订单名称
|
||||
*/
|
||||
@NotBlank(message = "订单名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "订单名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String orderName;
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
@NotNull(message = "金额不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "金额不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 支付状态
|
||||
*/
|
||||
@NotBlank(message = "支付状态不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "支付状态不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String paymentStatus;
|
||||
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
@NotBlank(message = "支付方式不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "支付方式不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String paymentMethod;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@NotNull(message = "用户ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "用户ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotBlank(message = "备注不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "备注不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.ruoyi.domain.bo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -23,7 +22,7 @@ public class ChatSessionBo extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,31 +24,31 @@ public class ChatUsageTokenBo extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*/
|
||||
@NotNull(message = "用户不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "用户不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 待结算token
|
||||
*/
|
||||
@NotNull(message = "待结算token不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "待结算token不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Integer token;
|
||||
|
||||
/**
|
||||
* 模型名称
|
||||
*/
|
||||
@NotBlank(message = "模型名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "模型名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String modelName;
|
||||
|
||||
/**
|
||||
* 累计使用token
|
||||
*/
|
||||
@NotBlank(message = "累计使用token不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "累计使用token不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String totalToken;
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.ruoyi.domain.McpInfo;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -19,40 +18,40 @@ import java.io.Serializable;
|
||||
@AutoMapper(target = McpInfo.class, reverseConvertGenerate = false)
|
||||
public class McpInfoBo implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@NotNull(message = "id不能为空" )
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@NotNull(message = "id不能为空")
|
||||
private Integer mcpId;
|
||||
|
||||
/**
|
||||
* 服务器名称
|
||||
*/
|
||||
/**
|
||||
* 服务器名称
|
||||
*/
|
||||
private String serverName;
|
||||
|
||||
/**
|
||||
* 链接方式
|
||||
*/
|
||||
/**
|
||||
* 链接方式
|
||||
*/
|
||||
private String transportType;
|
||||
|
||||
/**
|
||||
* Command
|
||||
*/
|
||||
/**
|
||||
* Command
|
||||
*/
|
||||
private String command;
|
||||
|
||||
/**
|
||||
* Args
|
||||
*/
|
||||
/**
|
||||
* Args
|
||||
*/
|
||||
private String arguments;
|
||||
private String description;
|
||||
/**
|
||||
* Env
|
||||
*/
|
||||
* Env
|
||||
*/
|
||||
private String env;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean status;
|
||||
|
||||
|
||||
|
||||
@@ -96,5 +96,4 @@ public class ChatMessageVo implements Serializable {
|
||||
private Date createTime;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 聊天模型视图对象 chat_model
|
||||
*
|
||||
@@ -104,7 +103,7 @@ public class ChatModelVo implements Serializable {
|
||||
* 模型供应商
|
||||
*/
|
||||
@ExcelProperty(value = "模型供应商")
|
||||
private String ProviderName;
|
||||
private String providerName;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
|
||||
@@ -11,8 +11,6 @@ import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 支付订单视图对象 chat_pay_order
|
||||
*
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 会话管理视图对象 chat_session
|
||||
*
|
||||
|
||||
@@ -10,8 +10,6 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用户token使用详情视图对象 chat_usage_token
|
||||
*
|
||||
|
||||
@@ -21,45 +21,45 @@ import java.io.Serializable;
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = McpInfo.class)
|
||||
public class McpInfoVo implements Serializable {
|
||||
private Integer mcpId;
|
||||
private Integer mcpId;
|
||||
|
||||
/**
|
||||
* 服务器名称
|
||||
*/
|
||||
@ExcelProperty(value = "服务器名称")
|
||||
private String serverName;
|
||||
/**
|
||||
* 服务器名称
|
||||
*/
|
||||
@ExcelProperty(value = "服务器名称")
|
||||
private String serverName;
|
||||
|
||||
/**
|
||||
* 链接方式
|
||||
*/
|
||||
@ExcelProperty(value = "链接方式", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "mcp_transport_type")
|
||||
private String transportType;
|
||||
/**
|
||||
* 链接方式
|
||||
*/
|
||||
@ExcelProperty(value = "链接方式", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "mcp_transport_type")
|
||||
private String transportType;
|
||||
|
||||
/**
|
||||
* Command
|
||||
*/
|
||||
@ExcelProperty(value = "Command")
|
||||
private String command;
|
||||
/**
|
||||
* Command
|
||||
*/
|
||||
@ExcelProperty(value = "Command")
|
||||
private String command;
|
||||
|
||||
/**
|
||||
* Args
|
||||
*/
|
||||
@ExcelProperty(value = "Args")
|
||||
private String arguments;
|
||||
/**
|
||||
* Args
|
||||
*/
|
||||
@ExcelProperty(value = "Args")
|
||||
private String arguments;
|
||||
@ExcelProperty(value = "Description")
|
||||
private String description;
|
||||
/**
|
||||
* Env
|
||||
*/
|
||||
@ExcelProperty(value = "Env")
|
||||
private String env;
|
||||
/**
|
||||
* Env
|
||||
*/
|
||||
@ExcelProperty(value = "Env")
|
||||
private String env;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@ExcelProperty(value = "是否启用")
|
||||
private Boolean status;
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@ExcelProperty(value = "是否启用")
|
||||
private Boolean status;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -53,21 +53,22 @@ public interface IChatModelService {
|
||||
* 通过模型名称获取模型信息
|
||||
*/
|
||||
ChatModelVo selectModelByName(String modelName);
|
||||
|
||||
/**
|
||||
* 通过模型分类获取模型信息
|
||||
*/
|
||||
ChatModelVo selectModelByCategory(String image);
|
||||
|
||||
|
||||
/**
|
||||
* 通过模型分类获取优先级最高的模型信息
|
||||
*/
|
||||
ChatModelVo selectModelByCategoryWithHighestPriority(String category);
|
||||
|
||||
|
||||
/**
|
||||
* 在同一分类下,查找优先级小于当前优先级的最高优先级模型(用于降级)。
|
||||
*/
|
||||
ChatModelVo selectFallbackModelByCategoryAndLessPriority(String category, Integer currentPriority);
|
||||
|
||||
|
||||
/**
|
||||
* 获取ppt模型信息
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@ public interface IChatTokenService {
|
||||
/**
|
||||
* 清空用户token
|
||||
*/
|
||||
void resetToken(Long userId,String modelName);
|
||||
void resetToken(Long userId, String modelName);
|
||||
|
||||
/**
|
||||
* 修改用户token
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ChatMessageServiceImpl implements IChatMessageService {
|
||||
* 查询聊天消息
|
||||
*/
|
||||
@Override
|
||||
public ChatMessageVo queryById(Long id){
|
||||
public ChatMessageVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ChatMessageServiceImpl implements IChatMessageService {
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<ChatMessageVo> queryPageList(ChatMessageBo bo, PageQuery pageQuery) {
|
||||
if(!LoginHelper.isLogin()){
|
||||
if (!LoginHelper.isLogin()) {
|
||||
return TableDataInfo.build();
|
||||
}
|
||||
// 只有非管理员才自动设置为自己的 ID
|
||||
@@ -104,7 +104,7 @@ public class ChatMessageServiceImpl implements IChatMessageService {
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ChatMessage entity){
|
||||
private void validEntityBeforeSave(ChatMessage entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public class ChatMessageServiceImpl implements IChatMessageService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ChatPayOrderServiceImpl implements IChatPayOrderService {
|
||||
* 查询支付订单
|
||||
*/
|
||||
@Override
|
||||
public ChatPayOrderVo queryById(Long id){
|
||||
public ChatPayOrderVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class ChatPayOrderServiceImpl implements IChatPayOrderService {
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ChatPayOrder entity){
|
||||
private void validEntityBeforeSave(ChatPayOrder entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public class ChatPayOrderServiceImpl implements IChatPayOrderService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ChatSessionServiceImpl implements IChatSessionService {
|
||||
* 查询会话管理
|
||||
*/
|
||||
@Override
|
||||
public ChatSessionVo queryById(Long id){
|
||||
public ChatSessionVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ChatSessionServiceImpl implements IChatSessionService {
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ChatSession entity){
|
||||
private void validEntityBeforeSave(ChatSession entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ChatSessionServiceImpl implements IChatSessionService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
|
||||
@@ -32,7 +32,6 @@ public class ChatTokenServiceImpl implements IChatTokenService {
|
||||
|
||||
/**
|
||||
* 清空用户token
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void resetToken(Long userId, String modelName) {
|
||||
@@ -43,7 +42,6 @@ public class ChatTokenServiceImpl implements IChatTokenService {
|
||||
|
||||
/**
|
||||
* 增加用户token
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void editToken(ChatUsageToken chatToken) {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ChatUsageTokenServiceImpl implements IChatUsageTokenService {
|
||||
* 查询用户token使用详情
|
||||
*/
|
||||
@Override
|
||||
public ChatUsageTokenVo queryById(Long id){
|
||||
public ChatUsageTokenVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class ChatUsageTokenServiceImpl implements IChatUsageTokenService {
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ChatUsageToken entity){
|
||||
private void validEntityBeforeSave(ChatUsageToken entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class ChatUsageTokenServiceImpl implements IChatUsageTokenService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.ruoyi.mapper.ChatMessageMapper">
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.ruoyi.mapper.ChatModelMapper">
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.ruoyi.mapper.ChatPayOrderMapper">
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
|
||||
@@ -16,11 +16,12 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class CodeFileLoader implements ResourceLoader {
|
||||
private final TextSplitter textSplitter;
|
||||
|
||||
@Override
|
||||
public String getContent(InputStream inputStream) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
try (InputStreamReader reader = new InputStreamReader(inputStream);
|
||||
BufferedReader bufferedReader = new BufferedReader(reader)){
|
||||
BufferedReader bufferedReader = new BufferedReader(reader)) {
|
||||
String line;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
stringBuffer.append(line).append("\n");
|
||||
@@ -30,8 +31,9 @@ public class CodeFileLoader implements ResourceLoader {
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getChunkList(String content, String kid){
|
||||
public List<String> getChunkList(String content, String kid) {
|
||||
return textSplitter.split(content, kid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,12 +12,14 @@ import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class ExcelFileLoader implements ResourceLoader {
|
||||
private final TextSplitter textSplitter;
|
||||
private static final int DEFAULT_BUFFER_SIZE = 8192;
|
||||
private final TextSplitter textSplitter;
|
||||
|
||||
@Override
|
||||
public String getContent(InputStream inputStream) {
|
||||
// 使用带缓冲的输入流包装(保持原流不自动关闭)
|
||||
|
||||
@@ -3,7 +3,7 @@ package org.ruoyi.chain.loader;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
public class FolderLoader implements ResourceLoader{
|
||||
public class FolderLoader implements ResourceLoader {
|
||||
@Override
|
||||
public String getContent(InputStream inputStream) {
|
||||
return null;
|
||||
|
||||
@@ -16,11 +16,12 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class MarkDownFileLoader implements ResourceLoader {
|
||||
private final TextSplitter textSplitter;
|
||||
|
||||
@Override
|
||||
public String getContent(InputStream inputStream) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
try (InputStreamReader reader = new InputStreamReader(inputStream);
|
||||
BufferedReader bufferedReader = new BufferedReader(reader)){
|
||||
BufferedReader bufferedReader = new BufferedReader(reader)) {
|
||||
String line;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
stringBuffer.append(line).append("\n");
|
||||
@@ -30,8 +31,9 @@ public class MarkDownFileLoader implements ResourceLoader {
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getChunkList(String content, String kid){
|
||||
public List<String> getChunkList(String content, String kid) {
|
||||
return textSplitter.split(content, kid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
public class PdfFileLoader implements ResourceLoader {
|
||||
private final TextSplitter characterTextSplitter;
|
||||
|
||||
@Override
|
||||
public String getContent(InputStream inputStream) {
|
||||
PDDocument document = null;
|
||||
|
||||
@@ -14,7 +14,6 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.ruoyi.chain.split.TextSplitter;
|
||||
import org.ruoyi.common.core.utils.StringUtils;
|
||||
import org.ruoyi.common.core.utils.file.FileUtils;
|
||||
import org.ruoyi.common.oss.core.OssClient;
|
||||
import org.ruoyi.common.oss.entity.UploadResult;
|
||||
@@ -44,11 +43,11 @@ import java.util.regex.Pattern;
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class PdfMinerUFileLoader implements ResourceLoader {
|
||||
// 预编译正则表达式
|
||||
private static final Pattern MD_IMAGE_PATTERN = Pattern.compile("!\\[(.*?)]\\((.*?)(\\s*=\\d+)?\\)");
|
||||
private final TextSplitter characterTextSplitter;
|
||||
private final PdfProperties properties;
|
||||
private final SysOssMapper sysOssMapper;
|
||||
// 预编译正则表达式
|
||||
private static final Pattern MD_IMAGE_PATTERN = Pattern.compile("!\\[(.*?)]\\((.*?)(\\s*=\\d+)?\\)");
|
||||
// OCR图片识别线程池
|
||||
private final ThreadPoolExecutor ocrExecutor = new ThreadPoolExecutor(
|
||||
// 核心线程数
|
||||
@@ -63,6 +62,184 @@ public class PdfMinerUFileLoader implements ResourceLoader {
|
||||
new ThreadPoolExecutor.CallerRunsPolicy()
|
||||
);
|
||||
|
||||
/**
|
||||
* 创建临时PDF文件
|
||||
*
|
||||
* @param is 输入流
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
private static File createTempFile(InputStream is) throws IOException {
|
||||
File tempFile = File.createTempFile("upload_", ".pdf");
|
||||
Files.copy(is, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
return tempFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建跨平台文件输出路径
|
||||
*
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
private static Path buildOutputPath() throws IOException {
|
||||
Path basePath = isWindows() ?
|
||||
// Windows C盘用户路径下 minerUOutPut,避免其他盘符权限问题
|
||||
Paths.get(System.getProperty("user.home")).resolve("minerUOutPut") :
|
||||
Paths.get("/var/minerUOutPut");
|
||||
|
||||
if (!Files.exists(basePath)) {
|
||||
Files.createDirectories(basePath);
|
||||
}
|
||||
return basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前操作系统是否为Windows
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static boolean isWindows() {
|
||||
return System.getProperty("os.name").toLowerCase().contains("win");
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行命令
|
||||
*
|
||||
* @param condaEnv conda环境路径
|
||||
* @param inputFile 输入文件
|
||||
* @param outputPath 输出路径
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
private static Process buildProcess(String condaEnv, File inputFile, Path outputPath) throws IOException {
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
String[] command;
|
||||
|
||||
if (isWindows()) {
|
||||
command = new String[]{
|
||||
"cmd", "/c",
|
||||
"call", "conda", "activate",
|
||||
condaEnv.replace("\"", ""),
|
||||
"&&", "magic-pdf",
|
||||
"-p", inputFile.getAbsolutePath(),
|
||||
"-o", outputPath.toString()
|
||||
};
|
||||
} else {
|
||||
command = new String[]{
|
||||
"bash", "-c",
|
||||
String.format("source '%s/bin/activate' && magic-pdf -p '%s' -o '%s'",
|
||||
condaEnv,
|
||||
inputFile.getAbsolutePath(),
|
||||
outputPath.toString())
|
||||
};
|
||||
}
|
||||
|
||||
return pb.command(command)
|
||||
.redirectErrorStream(true)
|
||||
.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 实时日志输出
|
||||
*
|
||||
* @param process 进程
|
||||
*/
|
||||
private static void logProcessOutput(Process process) {
|
||||
Executors.newSingleThreadExecutor().submit(() -> {
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream()))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
log.info("[PROCESS LOG] " + line);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证转换结果
|
||||
*
|
||||
* @param inputFile 输入文件
|
||||
* @param outputPath 输出路径
|
||||
* @param exitCode 退出码
|
||||
* @return
|
||||
*/
|
||||
private static String verifyResult(File inputFile, Path outputPath, int exitCode) {
|
||||
String baseName = FilenameUtils.removeExtension(inputFile.getName());
|
||||
Path expectedMd = outputPath
|
||||
.resolve(baseName)
|
||||
.resolve("auto")
|
||||
.resolve(baseName + ".md");
|
||||
|
||||
if (exitCode == 0 && Files.exists(expectedMd)) {
|
||||
log.info("转换成功:{}", expectedMd.toString());
|
||||
return expectedMd.toString();
|
||||
}
|
||||
return String.format("转换失败(退出码%d)| 预期文件:%s", exitCode, expectedMd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 多模态OCR识别图片内容
|
||||
*
|
||||
* @param imageUrl 图片URL
|
||||
* @return
|
||||
*/
|
||||
private static String imageUrlOCR(String imageUrl) {
|
||||
OpenAiChatModel model = OpenAiChatModel.builder()
|
||||
.apiKey("demo")
|
||||
.modelName("gpt-4o-mini")
|
||||
.baseUrl("http://langchain4j.dev/demo/openai/v1")
|
||||
.build();
|
||||
|
||||
UserMessage userMessage = UserMessage.from(
|
||||
TextContent.from(
|
||||
"请按以下逻辑处理图片:\n" +
|
||||
"1. 文字检测:识别图中所有可见文字(包括水印/标签),若无文字则跳至步骤3\n" +
|
||||
"2. 文字处理:\n" +
|
||||
" a. 对识别到的文字进行❗核心信息提炼\n" +
|
||||
" b. ❗禁止直接输出原文内容\n" +
|
||||
" c. 描述文字位置(如'顶部居中')、字体特征(颜色/大小)\n" +
|
||||
"3. 视觉描述:\n" +
|
||||
" a. 若无文字则用❗50字内简洁描述主体对象、场景、色彩搭配与画面氛围\n" +
|
||||
" b. 若有文字则补充说明文字与画面的关系\n" +
|
||||
"4. 输出规则:\n" +
|
||||
" - 最终输出为纯文本,格式:'[文字总结] 视觉描述 关键词:xx,xx'\n" +
|
||||
" - 关键词从内容中提取3个最具代表性的名词\n" +
|
||||
" - 无文字时格式:'[空] 简洁描述 关键词:xx,xx'"
|
||||
),
|
||||
ImageContent.from(imageUrl)
|
||||
);
|
||||
ChatResponse chat = model.chat(userMessage);
|
||||
AiMessage answer = chat.aiMessage();
|
||||
return answer.text();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理输出目录
|
||||
*
|
||||
* @param outputPath 输出目录
|
||||
*/
|
||||
private static void cleanOutputDirectory(Path outputPath) {
|
||||
if (Files.exists(outputPath)) {
|
||||
try {
|
||||
Files.walk(outputPath)
|
||||
// 按逆序删除(子目录先删)
|
||||
.sorted((p1, p2) -> -p1.compareTo(p2))
|
||||
.forEach(path -> {
|
||||
try {
|
||||
Files.delete(path);
|
||||
} catch (IOException e) {
|
||||
log.warn("清理输出目录失败: {}", path, e);
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
log.error("遍历输出目录失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContent(InputStream inputStream) {
|
||||
String content = "";
|
||||
@@ -127,127 +304,6 @@ public class PdfMinerUFileLoader implements ResourceLoader {
|
||||
return characterTextSplitter.split(content, kid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建临时PDF文件
|
||||
*
|
||||
* @param is 输入流
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
private static File createTempFile(InputStream is) throws IOException {
|
||||
File tempFile = File.createTempFile("upload_", ".pdf");
|
||||
Files.copy(is, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
return tempFile;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建跨平台文件输出路径
|
||||
*
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
private static Path buildOutputPath() throws IOException {
|
||||
Path basePath = isWindows() ?
|
||||
// Windows C盘用户路径下 minerUOutPut,避免其他盘符权限问题
|
||||
Paths.get(System.getProperty("user.home")).resolve("minerUOutPut") :
|
||||
Paths.get("/var/minerUOutPut");
|
||||
|
||||
if (!Files.exists(basePath)) {
|
||||
Files.createDirectories(basePath);
|
||||
}
|
||||
return basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前操作系统是否为Windows
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static boolean isWindows() {
|
||||
return System.getProperty("os.name").toLowerCase().contains("win");
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行命令
|
||||
*
|
||||
* @param condaEnv conda环境路径
|
||||
* @param inputFile 输入文件
|
||||
* @param outputPath 输出路径
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
private static Process buildProcess(String condaEnv, File inputFile, Path outputPath) throws IOException {
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
String[] command;
|
||||
|
||||
if (isWindows()) {
|
||||
command = new String[]{
|
||||
"cmd", "/c",
|
||||
"call", "conda", "activate",
|
||||
condaEnv.replace("\"", ""),
|
||||
"&&", "magic-pdf",
|
||||
"-p", inputFile.getAbsolutePath(),
|
||||
"-o", outputPath.toString()
|
||||
};
|
||||
} else {
|
||||
command = new String[]{
|
||||
"bash", "-c",
|
||||
String.format("source '%s/bin/activate' && magic-pdf -p '%s' -o '%s'",
|
||||
condaEnv,
|
||||
inputFile.getAbsolutePath(),
|
||||
outputPath.toString())
|
||||
};
|
||||
}
|
||||
|
||||
return pb.command(command)
|
||||
.redirectErrorStream(true)
|
||||
.start();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 实时日志输出
|
||||
*
|
||||
* @param process 进程
|
||||
*/
|
||||
private static void logProcessOutput(Process process) {
|
||||
Executors.newSingleThreadExecutor().submit(() -> {
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream()))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
log.info("[PROCESS LOG] " + line);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证转换结果
|
||||
*
|
||||
* @param inputFile 输入文件
|
||||
* @param outputPath 输出路径
|
||||
* @param exitCode 退出码
|
||||
* @return
|
||||
*/
|
||||
private static String verifyResult(File inputFile, Path outputPath, int exitCode) {
|
||||
String baseName = FilenameUtils.removeExtension(inputFile.getName());
|
||||
Path expectedMd = outputPath
|
||||
.resolve(baseName)
|
||||
.resolve("auto")
|
||||
.resolve(baseName + ".md");
|
||||
|
||||
if (exitCode == 0 && Files.exists(expectedMd)) {
|
||||
log.info("转换成功:{}", expectedMd.toString());
|
||||
return expectedMd.toString();
|
||||
}
|
||||
return String.format("转换失败(退出码%d)| 预期文件:%s", exitCode, expectedMd);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 正则匹配图片语法,多线程进行处理
|
||||
*
|
||||
@@ -300,7 +356,6 @@ public class PdfMinerUFileLoader implements ResourceLoader {
|
||||
return sb;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 图片处理任务
|
||||
*
|
||||
@@ -375,43 +430,6 @@ public class PdfMinerUFileLoader implements ResourceLoader {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 多模态OCR识别图片内容
|
||||
*
|
||||
* @param imageUrl 图片URL
|
||||
* @return
|
||||
*/
|
||||
private static String imageUrlOCR(String imageUrl) {
|
||||
OpenAiChatModel model = OpenAiChatModel.builder()
|
||||
.apiKey("demo")
|
||||
.modelName("gpt-4o-mini")
|
||||
.baseUrl("http://langchain4j.dev/demo/openai/v1")
|
||||
.build();
|
||||
|
||||
UserMessage userMessage = UserMessage.from(
|
||||
TextContent.from(
|
||||
"请按以下逻辑处理图片:\n" +
|
||||
"1. 文字检测:识别图中所有可见文字(包括水印/标签),若无文字则跳至步骤3\n" +
|
||||
"2. 文字处理:\n" +
|
||||
" a. 对识别到的文字进行❗核心信息提炼\n" +
|
||||
" b. ❗禁止直接输出原文内容\n" +
|
||||
" c. 描述文字位置(如'顶部居中')、字体特征(颜色/大小)\n" +
|
||||
"3. 视觉描述:\n" +
|
||||
" a. 若无文字则用❗50字内简洁描述主体对象、场景、色彩搭配与画面氛围\n" +
|
||||
" b. 若有文字则补充说明文字与画面的关系\n" +
|
||||
"4. 输出规则:\n" +
|
||||
" - 最终输出为纯文本,格式:'[文字总结] 视觉描述 关键词:xx,xx'\n" +
|
||||
" - 关键词从内容中提取3个最具代表性的名词\n" +
|
||||
" - 无文字时格式:'[空] 简洁描述 关键词:xx,xx'"
|
||||
),
|
||||
ImageContent.from(imageUrl)
|
||||
);
|
||||
ChatResponse chat = model.chat(userMessage);
|
||||
AiMessage answer = chat.aiMessage();
|
||||
return answer.text();
|
||||
}
|
||||
|
||||
/**
|
||||
* 静态内部类保存图片匹配信息
|
||||
*/
|
||||
@@ -421,29 +439,4 @@ public class PdfMinerUFileLoader implements ResourceLoader {
|
||||
int start; // 匹配起始位置
|
||||
int end; // 匹配结束位置
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 清理输出目录
|
||||
*
|
||||
* @param outputPath 输出目录
|
||||
*/
|
||||
private static void cleanOutputDirectory(Path outputPath) {
|
||||
if (Files.exists(outputPath)) {
|
||||
try {
|
||||
Files.walk(outputPath)
|
||||
// 按逆序删除(子目录先删)
|
||||
.sorted((p1, p2) -> -p1.compareTo(p2))
|
||||
.forEach(path -> {
|
||||
try {
|
||||
Files.delete(path);
|
||||
} catch (IOException e) {
|
||||
log.warn("清理输出目录失败: {}", path, e);
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
log.error("遍历输出目录失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,7 @@ package org.ruoyi.chain.loader;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.ruoyi.chain.split.*;
|
||||
|
||||
import org.ruoyi.config.properties.PdfProperties;
|
||||
import org.ruoyi.chain.split.CharacterTextSplitter;
|
||||
import org.ruoyi.chain.split.CodeTextSplitter;
|
||||
import org.ruoyi.chain.split.MarkdownTextSplitter;
|
||||
import org.ruoyi.constant.FileType;
|
||||
import org.ruoyi.system.mapper.SysOssMapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -23,22 +19,22 @@ public class ResourceLoaderFactory {
|
||||
private final SysOssMapper sysOssMapper;
|
||||
|
||||
|
||||
public ResourceLoader getLoaderByFileType(String fileType){
|
||||
if (FileType.isTextFile(fileType)){
|
||||
public ResourceLoader getLoaderByFileType(String fileType) {
|
||||
if (FileType.isTextFile(fileType)) {
|
||||
return new TextFileLoader(characterTextSplitter);
|
||||
} else if (FileType.isWord(fileType)) {
|
||||
return new WordLoader(characterTextSplitter);
|
||||
} else if (FileType.isPdf(fileType) && pdfProperties.getTransition().isEnableMinerU()) {
|
||||
return new PdfMinerUFileLoader(characterTextSplitter,pdfProperties,sysOssMapper);
|
||||
return new PdfMinerUFileLoader(characterTextSplitter, pdfProperties, sysOssMapper);
|
||||
} else if (FileType.isPdf(fileType)) {
|
||||
return new PdfFileLoader(characterTextSplitter);
|
||||
}else if (FileType.isMdFile(fileType)) {
|
||||
} else if (FileType.isMdFile(fileType)) {
|
||||
return new MarkDownFileLoader(markdownTextSplitter);
|
||||
}else if (FileType.isCodeFile(fileType)) {
|
||||
} else if (FileType.isCodeFile(fileType)) {
|
||||
return new CodeFileLoader(codeTextSplitter);
|
||||
} else if (FileType.isExcel(fileType)) {
|
||||
return new ExcelFileLoader(excelTextSplitter);
|
||||
}else {
|
||||
} else {
|
||||
return new TextFileLoader(characterTextSplitter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,29 +9,30 @@ import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class TextFileLoader implements ResourceLoader{
|
||||
public class TextFileLoader implements ResourceLoader {
|
||||
private final TextSplitter textSplitter;
|
||||
|
||||
@Override
|
||||
public String getContent(InputStream inputStream) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
try (InputStreamReader reader = new InputStreamReader(inputStream, "UTF-8");
|
||||
BufferedReader bufferedReader = new BufferedReader(reader)){
|
||||
String line;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
stringBuffer.append(line).append("\n");
|
||||
}
|
||||
String stringBuffer = "";
|
||||
try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
|
||||
BufferedReader bufferedReader = new BufferedReader(reader)) {
|
||||
stringBuffer = bufferedReader.lines().collect(Collectors.joining());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
return stringBuffer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getChunkList(String content, String kid){
|
||||
public List<String> getChunkList(String content, String kid) {
|
||||
return textSplitter.split(content, kid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class WordLoader implements ResourceLoader {
|
||||
private final TextSplitter textSplitter;
|
||||
|
||||
@Override
|
||||
public String getContent(InputStream inputStream) {
|
||||
XWPFDocument document = null;
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
package org.ruoyi.chain.split;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.ruoyi.common.core.utils.StringUtils;
|
||||
import org.ruoyi.domain.vo.KnowledgeInfoVo;
|
||||
import org.ruoyi.service.IKnowledgeInfoService;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -16,7 +12,7 @@ import java.util.List;
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class ExcelTextSplitter implements TextSplitter{
|
||||
public class ExcelTextSplitter implements TextSplitter {
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class MarkdownTextSplitter implements TextSplitter{
|
||||
public class MarkdownTextSplitter implements TextSplitter {
|
||||
@Override
|
||||
public List<String> split(String content, String kid) {
|
||||
return null;
|
||||
|
||||
@@ -39,62 +39,56 @@ public class FileType {
|
||||
public static final String YAML = "yaml";
|
||||
public static final String YML = "yml";
|
||||
|
||||
public static boolean isTextFile(String type){
|
||||
public static boolean isTextFile(String type) {
|
||||
if (type.equalsIgnoreCase(TXT) || type.equalsIgnoreCase(CSV) || type.equalsIgnoreCase(PROPERTIES)
|
||||
|| type.equalsIgnoreCase(INI) || type.equalsIgnoreCase(YAML) || type.equalsIgnoreCase(YML)
|
||||
|| type.equalsIgnoreCase(LOG) || type.equalsIgnoreCase(XML)){
|
||||
|| type.equalsIgnoreCase(LOG) || type.equalsIgnoreCase(XML)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isCodeFile(String type){
|
||||
public static boolean isCodeFile(String type) {
|
||||
if (type.equalsIgnoreCase(JAVA) || type.equalsIgnoreCase(HTML) || type.equalsIgnoreCase(HTM) || type.equalsIgnoreCase(JS) || type.equalsIgnoreCase(PY)
|
||||
|| type.equalsIgnoreCase(CPP) || type.equalsIgnoreCase(SQL) || type.equalsIgnoreCase(PHP) || type.equalsIgnoreCase(RUBY)
|
||||
|| type.equalsIgnoreCase(C) || type.equalsIgnoreCase(H) || type.equalsIgnoreCase(HPP) || type.equalsIgnoreCase(SWIFT)
|
||||
|| type.equalsIgnoreCase(TS) || type.equalsIgnoreCase(RUST) || type.equalsIgnoreCase(PERL) || type.equalsIgnoreCase(SHELL)
|
||||
|| type.equalsIgnoreCase(BAT) || type.equalsIgnoreCase(CMD) || type.equalsIgnoreCase(CSS)){
|
||||
|| type.equalsIgnoreCase(BAT) || type.equalsIgnoreCase(CMD) || type.equalsIgnoreCase(CSS)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isMdFile(String type){
|
||||
if (type.equalsIgnoreCase(MD)){
|
||||
public static boolean isMdFile(String type) {
|
||||
if (type.equalsIgnoreCase(MD)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isWord(String type){
|
||||
if (type.equalsIgnoreCase(DOC) || type.equalsIgnoreCase(DOCX)){
|
||||
public static boolean isWord(String type) {
|
||||
if (type.equalsIgnoreCase(DOC) || type.equalsIgnoreCase(DOCX)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPdf(String type){
|
||||
if (type.equalsIgnoreCase(PDF)){
|
||||
public static boolean isPdf(String type) {
|
||||
if (type.equalsIgnoreCase(PDF)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isExcel(String type){
|
||||
if (type.equalsIgnoreCase(XLS) || type.equalsIgnoreCase(XLSX)){
|
||||
public static boolean isExcel(String type) {
|
||||
if (type.equalsIgnoreCase(XLS) || type.equalsIgnoreCase(XLSX)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,66 +19,65 @@ import java.io.Serial;
|
||||
@TableName("knowledge_attach")
|
||||
public class KnowledgeAttach extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 知识库ID
|
||||
*/
|
||||
private String kid;
|
||||
/**
|
||||
* 知识库ID
|
||||
*/
|
||||
private String kid;
|
||||
|
||||
/**
|
||||
* 文档ID
|
||||
*/
|
||||
private String docId;
|
||||
/**
|
||||
* 文档ID
|
||||
*/
|
||||
private String docId;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
private String docName;
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
private String docName;
|
||||
|
||||
/**
|
||||
* 文档类型
|
||||
*/
|
||||
private String docType;
|
||||
/**
|
||||
* 文档类型
|
||||
*/
|
||||
private String docType;
|
||||
|
||||
/**
|
||||
* 文档内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 文档内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
/**
|
||||
* 对象存储主键
|
||||
*/
|
||||
private Long ossId;
|
||||
/**
|
||||
* 对象存储主键
|
||||
*/
|
||||
private Long ossId;
|
||||
|
||||
|
||||
/**
|
||||
* 拆解图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
private Integer picStatus;
|
||||
|
||||
/**
|
||||
* 拆解图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
private Integer picStatus;
|
||||
/**
|
||||
* 分析图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
private Integer picAnysStatus;
|
||||
|
||||
/**
|
||||
* 分析图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
private Integer picAnysStatus;
|
||||
|
||||
/**
|
||||
* 写入向量数据库状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
private Integer vectorStatus;
|
||||
/**
|
||||
* 写入向量数据库状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
private Integer vectorStatus;
|
||||
|
||||
}
|
||||
|
||||
@@ -21,72 +21,72 @@ import org.ruoyi.domain.KnowledgeAttach;
|
||||
@AutoMapper(target = KnowledgeAttach.class, reverseConvertGenerate = false)
|
||||
public class KnowledgeAttachBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@NotNull(message = "不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@NotNull(message = "不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 知识库ID
|
||||
*/
|
||||
@NotBlank(message = "知识库ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String kid;
|
||||
/**
|
||||
* 知识库ID
|
||||
*/
|
||||
@NotBlank(message = "知识库ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String kid;
|
||||
|
||||
/**
|
||||
* 文档ID
|
||||
*/
|
||||
@NotBlank(message = "文档ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String docId;
|
||||
/**
|
||||
* 文档ID
|
||||
*/
|
||||
@NotBlank(message = "文档ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String docId;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
@NotBlank(message = "文档名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String docName;
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
@NotBlank(message = "文档名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String docName;
|
||||
|
||||
/**
|
||||
* 文档类型
|
||||
*/
|
||||
@NotBlank(message = "文档类型不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String docType;
|
||||
/**
|
||||
* 文档类型
|
||||
*/
|
||||
@NotBlank(message = "文档类型不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String docType;
|
||||
|
||||
/**
|
||||
* 文档内容
|
||||
*/
|
||||
@NotBlank(message = "文档内容不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String content;
|
||||
/**
|
||||
* 文档内容
|
||||
*/
|
||||
@NotBlank(message = "文档内容不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotBlank(message = "备注不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String remark;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotBlank(message = "备注不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 对象存储主键
|
||||
*/
|
||||
@NotNull(message = "对象存储主键不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long ossId;
|
||||
/**
|
||||
* 对象存储主键
|
||||
*/
|
||||
@NotNull(message = "对象存储主键不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long ossId;
|
||||
|
||||
|
||||
/**
|
||||
* 拆解图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@NotNull(message = "拆解图片状态10未开始,20进行中,30已完成不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Integer picStatus;
|
||||
/**
|
||||
* 拆解图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@NotNull(message = "拆解图片状态10未开始,20进行中,30已完成不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Integer picStatus;
|
||||
|
||||
/**
|
||||
* 分析图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@NotNull(message = "分析图片状态10未开始,20进行中,30已完成不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Integer picAnysStatus;
|
||||
/**
|
||||
* 分析图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@NotNull(message = "分析图片状态10未开始,20进行中,30已完成不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Integer picAnysStatus;
|
||||
|
||||
/**
|
||||
* 写入向量数据库状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@NotNull(message = "写入向量数据库状态10未开始,20进行中,30已完成不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Integer vectorStatus;
|
||||
/**
|
||||
* 写入向量数据库状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@NotNull(message = "写入向量数据库状态10未开始,20进行中,30已完成不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Integer vectorStatus;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -24,43 +24,43 @@ public class KnowledgeFragmentBo extends BaseEntity {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@NotNull(message = "不能为空", groups = { EditGroup.class })
|
||||
@NotNull(message = "不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 知识库ID
|
||||
*/
|
||||
@NotBlank(message = "知识库ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "知识库ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String kid;
|
||||
|
||||
/**
|
||||
* 文档ID
|
||||
*/
|
||||
@NotBlank(message = "文档ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "文档ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String docId;
|
||||
|
||||
/**
|
||||
* 知识片段ID
|
||||
*/
|
||||
@NotBlank(message = "知识片段ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "知识片段ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String fid;
|
||||
|
||||
/**
|
||||
* 片段索引下标
|
||||
*/
|
||||
@NotNull(message = "片段索引下标不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "片段索引下标不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long idx;
|
||||
|
||||
/**
|
||||
* 文档内容
|
||||
*/
|
||||
@NotBlank(message = "文档内容不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "文档内容不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotBlank(message = "备注不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "备注不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
@@ -22,33 +22,33 @@ import org.ruoyi.domain.KnowledgeInfo;
|
||||
public class KnowledgeInfoBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "不能为空", groups = { EditGroup.class })
|
||||
@NotNull(message = "不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 知识库ID
|
||||
*/
|
||||
@NotBlank(message = "知识库ID不能为空", groups = {EditGroup.class })
|
||||
@NotBlank(message = "知识库ID不能为空", groups = {EditGroup.class})
|
||||
private String kid;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@NotNull(message = "用户ID不能为空", groups = {EditGroup.class })
|
||||
@NotNull(message = "用户ID不能为空", groups = {EditGroup.class})
|
||||
private Long uid;
|
||||
|
||||
/**
|
||||
* 知识库名称
|
||||
*/
|
||||
@NotBlank(message = "知识库名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "知识库名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String kname;
|
||||
|
||||
/**
|
||||
* 是否公开知识库(0 否 1是)
|
||||
*/
|
||||
@NotNull(message = "是否公开知识库(0 否 1是)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "是否公开知识库(0 否 1是)不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Integer share;
|
||||
|
||||
/**
|
||||
@@ -74,19 +74,19 @@ public class KnowledgeInfoBo extends BaseEntity {
|
||||
/**
|
||||
* 知识库中检索的条数
|
||||
*/
|
||||
@NotNull(message = "知识库中检索的条数不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "知识库中检索的条数不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long retrieveLimit;
|
||||
|
||||
/**
|
||||
* 文本块大小
|
||||
*/
|
||||
@NotNull(message = "文本块大小不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "文本块大小不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long textBlockSize;
|
||||
|
||||
/**
|
||||
* 向量库模型名称
|
||||
*/
|
||||
@NotBlank(message = "向量库不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "向量库不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String vectorModelName;
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ import lombok.Data;
|
||||
|
||||
/**
|
||||
* 查询向量所需参数
|
||||
*
|
||||
* @author ageer
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 保存向量所需参数
|
||||
*
|
||||
* @author ageer
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -21,74 +21,73 @@ import java.io.Serializable;
|
||||
@AutoMapper(target = KnowledgeAttach.class)
|
||||
public class KnowledgeAttachVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Long id;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 知识库ID
|
||||
*/
|
||||
@ExcelProperty(value = "知识库ID")
|
||||
private String kid;
|
||||
/**
|
||||
* 知识库ID
|
||||
*/
|
||||
@ExcelProperty(value = "知识库ID")
|
||||
private String kid;
|
||||
|
||||
/**
|
||||
* 文档ID
|
||||
*/
|
||||
@ExcelProperty(value = "文档ID")
|
||||
private String docId;
|
||||
/**
|
||||
* 文档ID
|
||||
*/
|
||||
@ExcelProperty(value = "文档ID")
|
||||
private String docId;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
@ExcelProperty(value = "文档名称")
|
||||
private String docName;
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
@ExcelProperty(value = "文档名称")
|
||||
private String docName;
|
||||
|
||||
/**
|
||||
* 文档类型
|
||||
*/
|
||||
@ExcelProperty(value = "文档类型")
|
||||
private String docType;
|
||||
/**
|
||||
* 文档类型
|
||||
*/
|
||||
@ExcelProperty(value = "文档类型")
|
||||
private String docType;
|
||||
|
||||
/**
|
||||
* 文档内容
|
||||
*/
|
||||
@ExcelProperty(value = "文档内容")
|
||||
private String content;
|
||||
/**
|
||||
* 文档内容
|
||||
*/
|
||||
@ExcelProperty(value = "文档内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 对象存储主键
|
||||
*/
|
||||
@ExcelProperty(value = "对象存储主键")
|
||||
private Long ossId;
|
||||
/**
|
||||
* 对象存储主键
|
||||
*/
|
||||
@ExcelProperty(value = "对象存储主键")
|
||||
private Long ossId;
|
||||
|
||||
|
||||
/**
|
||||
* 拆解图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@ExcelProperty(value = "拆解图片状态10未开始,20进行中,30已完成")
|
||||
private Integer picStatus;
|
||||
|
||||
/**
|
||||
* 拆解图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@ExcelProperty(value = "拆解图片状态10未开始,20进行中,30已完成")
|
||||
private Integer picStatus;
|
||||
/**
|
||||
* 分析图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@ExcelProperty(value = "分析图片状态10未开始,20进行中,30已完成")
|
||||
private Integer picAnysStatus;
|
||||
|
||||
/**
|
||||
* 分析图片状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@ExcelProperty(value = "分析图片状态10未开始,20进行中,30已完成")
|
||||
private Integer picAnysStatus;
|
||||
|
||||
/**
|
||||
* 写入向量数据库状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@ExcelProperty(value = "写入向量数据库状态10未开始,20进行中,30已完成")
|
||||
private Integer vectorStatus;
|
||||
/**
|
||||
* 写入向量数据库状态10未开始,20进行中,30已完成
|
||||
*/
|
||||
@ExcelProperty(value = "写入向量数据库状态10未开始,20进行中,30已完成")
|
||||
private Integer vectorStatus;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 知识片段视图对象 knowledge_fragment
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user