字段修改

This commit is contained in:
2025-12-19 17:17:27 +08:00
parent 428b8ce28e
commit cc372bc7ea
7 changed files with 32 additions and 16 deletions

View File

@@ -9,7 +9,7 @@ CREATE TABLE ai.tb_agent(
description VARCHAR(500) DEFAULT NULL, -- 智能体描述 description VARCHAR(500) DEFAULT NULL, -- 智能体描述
link VARCHAR(500) DEFAULT NULL, -- 智能体url link VARCHAR(500) DEFAULT NULL, -- 智能体url
api_key VARCHAR(500) NOT NULL, -- dify智能体APIKEY api_key VARCHAR(500) NOT NULL, -- dify智能体APIKEY
outer BOOLEAN DEFAULT false, -- 是否是对外智能体,未登录可用 is_outer BOOLEAN DEFAULT false, -- 是否是对外智能体,未登录可用
introduce VARCHAR(500) NOT NULL, -- 引导词 introduce VARCHAR(500) NOT NULL, -- 引导词
prompt_cards JSONB DEFAULT '[]'::jsonb, -- 提示卡片数组 [{file_id:'', prompt:''}] prompt_cards JSONB DEFAULT '[]'::jsonb, -- 提示卡片数组 [{file_id:'', prompt:''}]
category VARCHAR(50) NOT NULL, -- 分类 category VARCHAR(50) NOT NULL, -- 分类
@@ -33,7 +33,7 @@ CREATE TABLE ai.tb_chat(
user_id VARCHAR(50) NOT NULL, -- 用户ID user_id VARCHAR(50) NOT NULL, -- 用户ID
user_type BOOLEAN NOT NULL DEFAULT true, -- 用户类型 true-系统内部人员 false-系统外部人员 user_type BOOLEAN NOT NULL DEFAULT true, -- 用户类型 true-系统内部人员 false-系统外部人员
title VARCHAR(500) NOT NULL, -- 对话标题 title VARCHAR(500) NOT NULL, -- 对话标题
channel VARCHAR(50) DEFAULT 'agent' -- 对话渠道 agent、wechat channel VARCHAR(50) DEFAULT 'agent', -- 对话渠道 agent、wechat
create_time TIMESTAMPTZ NOT NULL DEFAULT now(), -- 创建时间 create_time TIMESTAMPTZ NOT NULL DEFAULT now(), -- 创建时间
update_time TIMESTAMPTZ DEFAULT NULL, -- 更新时间 update_time TIMESTAMPTZ DEFAULT NULL, -- 更新时间
delete_time TIMESTAMPTZ DEFAULT NULL, -- 删除时间 delete_time TIMESTAMPTZ DEFAULT NULL, -- 删除时间

View File

@@ -38,7 +38,7 @@ CREATE TABLE workcase.tb_workcase(
type VARCHAR(50) NOT NULL, -- 故障类型 type VARCHAR(50) NOT NULL, -- 故障类型
device VARCHAR(50) NOT NULL, -- 设备名称 device VARCHAR(50) NOT NULL, -- 设备名称
device_code VARCHAR(50) NOT NULL, -- 设备代码 device_code VARCHAR(50) NOT NULL, -- 设备代码
imgs VARCHAR(50)[] DEFAULT '[]', -- 工单图片id imgs VARCHAR(50)[] DEFAULT '{}', -- 工单图片id
emergency VARCHAR(50) NOT NULL DEFAULT 'normal', -- 紧急程度 normal-普通 emergency-紧急 emergency VARCHAR(50) NOT NULL DEFAULT 'normal', -- 紧急程度 normal-普通 emergency-紧急
status VARCHAR(50) NOT NULL DEFAULT 'pending', -- 状态 pending-待处理 processing-处理中 done-已完成 status VARCHAR(50) NOT NULL DEFAULT 'pending', -- 状态 pending-待处理 processing-处理中 done-已完成
processor VARCHAR(50) DEFAULT NULL, -- 处理人 processor VARCHAR(50) DEFAULT NULL, -- 处理人
@@ -60,7 +60,7 @@ CREATE TABLE workcase.tb_workcase_process(
process_id VARCHAR(50) NOT NULL, -- 过程id process_id VARCHAR(50) NOT NULL, -- 过程id
action VARCHAR(50) NOT NULL, -- 动作 info记录assign指派redeploy转派repeal撤销finish完成 action VARCHAR(50) NOT NULL, -- 动作 info记录assign指派redeploy转派repeal撤销finish完成
message VARCHAR(200) DEFAULT NULL, -- 消息 message VARCHAR(200) DEFAULT NULL, -- 消息
files VARCHAR(50)[] DEFAULT '[]', -- 携带文件 files VARCHAR(50)[] DEFAULT '{}', -- 携带文件
processor VARCHAR(50) DEFAULT NULL, -- 处理人(指派、转派专属) processor VARCHAR(50) DEFAULT NULL, -- 处理人(指派、转派专属)
remark VARCHAR(500) DEFAULT NULL, -- 备注 remark VARCHAR(500) DEFAULT NULL, -- 备注
creator VARCHAR(50) NOT NULL, -- 过程发起人 creator VARCHAR(50) NOT NULL, -- 过程发起人

View File

@@ -90,7 +90,7 @@ public class AgentChatServiceImpl implements AgentChatService {
private Boolean isOuterAgent(String agentId){ private Boolean isOuterAgent(String agentId){
// 智能体必须是outer // 智能体必须是outer
ResultDomain<TbAgent> agentResult = agentService.selectAgentById(agentId); ResultDomain<TbAgent> agentResult = agentService.selectAgentById(agentId);
if(!agentResult.getSuccess()|| agentResult.getData() == null || !agentResult.getData().getOuter()){ if(!agentResult.getSuccess()|| agentResult.getData() == null || !agentResult.getData().getIsOuter()){
return false; return false;
} }
return true; return true;
@@ -101,7 +101,7 @@ public class AgentChatServiceImpl implements AgentChatService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResultDomain<TbChat> createChat(TbChat chat) { public ResultDomain<TbChat> createChat(TbChat chat) {
// 如果是来客userType=false校验智能体是否是 outer // 如果是来客userType=false校验智能体是否是 isOuter
if(!chat.getUserType()){ if(!chat.getUserType()){
if(!isOuterAgent(chat.getAgentId())){ if(!isOuterAgent(chat.getAgentId())){
return ResultDomain.failure("智能体不可用"); return ResultDomain.failure("智能体不可用");
@@ -235,7 +235,7 @@ public class AgentChatServiceImpl implements AgentChatService {
// 1. 校验智能体 // 1. 校验智能体
ResultDomain<TbAgent> agentResult = agentService.selectAgentById(agentId); ResultDomain<TbAgent> agentResult = agentService.selectAgentById(agentId);
if (!agentResult.getSuccess() || agentResult.getData() == null || !agentResult.getData().getOuter()) { if (!agentResult.getSuccess() || agentResult.getData() == null || !agentResult.getData().getIsOuter()) {
return ResultDomain.failure("智能体不存在或不可用"); return ResultDomain.failure("智能体不存在或不可用");
} }
TbAgent agent = agentResult.getData(); TbAgent agent = agentResult.getData();
@@ -409,7 +409,7 @@ public class AgentChatServiceImpl implements AgentChatService {
public ResultDomain<Boolean> stopChatMessageByTaskId(TbChat filter, String taskId) { public ResultDomain<Boolean> stopChatMessageByTaskId(TbChat filter, String taskId) {
// 1. 获取智能体 // 1. 获取智能体
ResultDomain<TbAgent> agentResult = agentService.selectAgentById(filter.getAgentId()); ResultDomain<TbAgent> agentResult = agentService.selectAgentById(filter.getAgentId());
if (!agentResult.getSuccess() || agentResult.getData() == null || !agentResult.getData().getOuter()) { if (!agentResult.getSuccess() || agentResult.getData() == null || !agentResult.getData().getIsOuter()) {
return ResultDomain.failure("智能体不存在"); return ResultDomain.failure("智能体不存在");
} }
TbAgent agent = agentResult.getData(); TbAgent agent = agentResult.getData();

View File

@@ -9,7 +9,7 @@
<result column="description" property="description" jdbcType="VARCHAR"/> <result column="description" property="description" jdbcType="VARCHAR"/>
<result column="link" property="link" jdbcType="VARCHAR"/> <result column="link" property="link" jdbcType="VARCHAR"/>
<result column="api_key" property="apiKey" jdbcType="VARCHAR"/> <result column="api_key" property="apiKey" jdbcType="VARCHAR"/>
<result column="outer" property="outer" jdbcType="BOOLEAN"/> <result column="is_outer" property="isOuter" jdbcType="BOOLEAN"/>
<result column="introduce" property="introduce" jdbcType="VARCHAR"/> <result column="introduce" property="introduce" jdbcType="VARCHAR"/>
<result column="prompt_cards" property="promptCards" jdbcType="OTHER" typeHandler="org.xyzh.ai.handler.PromptCardsTypeHandler"/> <result column="prompt_cards" property="promptCards" jdbcType="OTHER" typeHandler="org.xyzh.ai.handler.PromptCardsTypeHandler"/>
<result column="category" property="category" jdbcType="VARCHAR"/> <result column="category" property="category" jdbcType="VARCHAR"/>
@@ -22,21 +22,21 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
optsn, agent_id, name, description, link, api_key, outer, introduce, prompt_cards, optsn, agent_id, name, description, link, api_key, is_outer, introduce, prompt_cards,
category, creator, updater, create_time, update_time, delete_time, deleted category, creator, updater, create_time, update_time, delete_time, deleted
</sql> </sql>
<insert id="insertAgent" parameterType="org.xyzh.api.ai.dto.TbAgent"> <insert id="insertAgent" parameterType="org.xyzh.api.ai.dto.TbAgent">
INSERT INTO ai.tb_agent ( INSERT INTO ai.tb_agent (
optsn, agent_id, name, api_key, introduce, category optsn, agent_id, name, api_key, introduce, category
<if test="outer !=null">, outer</if> <if test="isOuter !=null">, is_outer</if>
<if test="description != null">, description</if> <if test="description != null">, description</if>
<if test="link != null">, link</if> <if test="link != null">, link</if>
<if test="promptCards != null">, prompt_cards</if> <if test="promptCards != null">, prompt_cards</if>
<if test="creator != null">, creator</if> <if test="creator != null">, creator</if>
) VALUES ( ) VALUES (
#{optsn}, #{agentId}, #{name}, #{apiKey}, #{introduce}, #{category} #{optsn}, #{agentId}, #{name}, #{apiKey}, #{introduce}, #{category}
<if test="outer !=null">, #{outer}</if> <if test="isOuter !=null">, #{isOuter}</if>
<if test="description != null">, #{description}</if> <if test="description != null">, #{description}</if>
<if test="link != null">, #{link}</if> <if test="link != null">, #{link}</if>
<if test="promptCards != null">, #{promptCards, typeHandler=org.xyzh.ai.handler.PromptCardsTypeHandler}</if> <if test="promptCards != null">, #{promptCards, typeHandler=org.xyzh.ai.handler.PromptCardsTypeHandler}</if>
@@ -51,7 +51,7 @@
<if test="description != null">description = #{description},</if> <if test="description != null">description = #{description},</if>
<if test="link != null">link = #{link},</if> <if test="link != null">link = #{link},</if>
<if test="apiKey != null">api_key = #{apiKey},</if> <if test="apiKey != null">api_key = #{apiKey},</if>
<if test="outer != null">outer = #{outer},</if> <if test="isOuter != null">is_outer = #{isOuter},</if>
<if test="introduce != null">introduce = #{introduce},</if> <if test="introduce != null">introduce = #{introduce},</if>
<if test="promptCards != null">prompt_cards = #{promptCards, typeHandler=org.xyzh.ai.handler.PromptCardsTypeHandler},</if> <if test="promptCards != null">prompt_cards = #{promptCards, typeHandler=org.xyzh.ai.handler.PromptCardsTypeHandler},</if>
<if test="category != null">category = #{category},</if> <if test="category != null">category = #{category},</if>

View File

@@ -30,7 +30,7 @@ public class TbAgent extends BaseDTO{
private String apiKey; private String apiKey;
@Schema(description = "是否是对外智能体,未登录可用") @Schema(description = "是否是对外智能体,未登录可用")
private Boolean outer; private Boolean isOuter;
@Schema(description = "引导词") @Schema(description = "引导词")
private String introduce; private String introduce;

View File

@@ -36,7 +36,7 @@ public class AgentVO extends BaseVO{
private String apiKey; private String apiKey;
@Schema(description = "是否是对外智能体,未登录可用") @Schema(description = "是否是对外智能体,未登录可用")
private Boolean outer; private Boolean isOuter;
@Schema(description = "引导词") @Schema(description = "引导词")
private String introduce; private String introduce;

View File

@@ -12,7 +12,7 @@
<groupId>org.xyzh</groupId> <groupId>org.xyzh</groupId>
<artifactId>workcase</artifactId> <artifactId>workcase</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<packaging>jar</packaging>
<properties> <properties>
<maven.compiler.source>21</maven.compiler.source> <maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target> <maven.compiler.target>21</maven.compiler.target>
@@ -53,6 +53,16 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.dubbo</groupId> <groupId>org.apache.dubbo</groupId>
@@ -61,6 +71,12 @@
<dependency> <dependency>
<groupId>org.mybatis.spring.boot</groupId> <groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId> <artifactId>mybatis-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>