8 Commits

Author SHA1 Message Date
lindaxia
deefb6cc0b Merge branch 'main' of https://github.com/ageerle/ruoyi-ai 2025-05-26 22:45:18 +08:00
lindaxia
fa96c3d12f feat: 更新deploy脚本 2025-05-26 22:43:54 +08:00
ageerle
77069fdecd feat: 移除聊天、会话角色校验 2025-05-26 22:41:55 +08:00
ageerle
db4a264a52 Merge remote-tracking branch 'origin/main' 2025-05-26 22:40:17 +08:00
ageerle
70ae7ea8f1 feat: 向量库查询删除逻辑调整 2025-05-26 22:40:01 +08:00
lindaxia
6a93856d90 feat: 更新deploy脚本 2025-05-26 22:24:17 +08:00
lindaxia
71cae94815 Revert "lindaxia"
This reverts commit a2905d08f9.
2025-05-26 22:20:51 +08:00
lindaxia
a2905d08f9 lindaxia
feat: 更新deploy
2025-05-26 22:16:23 +08:00
17 changed files with 1390 additions and 1889 deletions

View File

@@ -17,10 +17,7 @@ public interface VectorStoreService {
void createSchema(String kid,String modelName);
void removeByKid(String kid,String modelName);
void removeById(String id,String modelName);
void removeByDocId(String kid,String docId,String modelName);
void removeByKidAndFid(String kid, String fid,String modelName);
}

View File

@@ -9,8 +9,6 @@ import dev.langchain4j.model.openai.OpenAiEmbeddingModel;
import dev.langchain4j.store.embedding.EmbeddingMatch;
import dev.langchain4j.store.embedding.EmbeddingSearchRequest;
import dev.langchain4j.store.embedding.EmbeddingStore;
import dev.langchain4j.store.embedding.filter.Filter;
import dev.langchain4j.store.embedding.filter.comparison.IsEqualTo;
import dev.langchain4j.store.embedding.weaviate.WeaviateEmbeddingStore;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
@@ -22,9 +20,7 @@ import org.ruoyi.service.VectorStoreService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 向量库管理
@@ -40,6 +36,7 @@ public class VectorStoreServiceImpl implements VectorStoreService {
private EmbeddingStore<TextSegment> embeddingStore;
@Override
public void createSchema(String kid, String modelName) {
String protocol = configService.getConfigValue("weaviate", "protocol");
@@ -48,7 +45,7 @@ public class VectorStoreServiceImpl implements VectorStoreService {
embeddingStore = WeaviateEmbeddingStore.builder()
.scheme(protocol)
.host(host)
.objectClass(className + kid)
.objectClass(className+kid)
.scheme(protocol)
.avoidDups(true)
.consistencyLevel("ALL")
@@ -61,14 +58,9 @@ public class VectorStoreServiceImpl implements VectorStoreService {
EmbeddingModel embeddingModel = getEmbeddingModel(storeEmbeddingBo.getEmbeddingModelName(),
storeEmbeddingBo.getApiKey(), storeEmbeddingBo.getBaseUrl());
List<String> chunkList = storeEmbeddingBo.getChunkList();
for (int i = 0; i < chunkList.size(); i++) {
Map<String, Object> dataSchema = new HashMap<>();
dataSchema.put("kid", storeEmbeddingBo.getKid());
dataSchema.put("docId", storeEmbeddingBo.getDocId());
dataSchema.put("fid", storeEmbeddingBo.getFids().get(i));
Embedding embedding = embeddingModel.embed(chunkList.get(i)).content();
TextSegment segment = TextSegment.from(chunkList.get(i));
segment.metadata().putAll(dataSchema);
for (String s : chunkList) {
Embedding embedding = embeddingModel.embed(s).content();
TextSegment segment = TextSegment.from(s);
embeddingStore.add(embedding, segment);
}
}
@@ -78,13 +70,10 @@ public class VectorStoreServiceImpl implements VectorStoreService {
createSchema(queryVectorBo.getKid(), queryVectorBo.getVectorModelName());
EmbeddingModel embeddingModel = getEmbeddingModel(queryVectorBo.getEmbeddingModelName(),
queryVectorBo.getApiKey(), queryVectorBo.getBaseUrl());
// Filter simpleFilter = new IsEqualTo("kid", queryVectorBo.getKid());
Embedding queryEmbedding = embeddingModel.embed(queryVectorBo.getQuery()).content();
EmbeddingSearchRequest embeddingSearchRequest = EmbeddingSearchRequest.builder()
.queryEmbedding(queryEmbedding)
.maxResults(queryVectorBo.getMaxResults())
// 添加过滤条件
// .filter(simpleFilter)
.build();
List<EmbeddingMatch<TextSegment>> matches = embeddingStore.search(embeddingSearchRequest).matches();
List<String> results = new ArrayList<>();
@@ -94,29 +83,10 @@ public class VectorStoreServiceImpl implements VectorStoreService {
@Override
public void removeByKid(String kid, String modelName) {
createSchema(kid, modelName);
public void removeById(String id, String modelName) {
createSchema(id, modelName);
// 根据条件删除向量数据
Filter simpleFilter = new IsEqualTo("kid", kid);
embeddingStore.removeAll(simpleFilter);
}
@Override
public void removeByDocId(String kid, String docId, String modelName) {
createSchema(kid, modelName);
// 根据条件删除向量数据
Filter simpleFilterByDocId = new IsEqualTo("docId", docId);
embeddingStore.removeAll(simpleFilterByDocId);
}
@Override
public void removeByKidAndFid(String kid, String fid, String modelName) {
createSchema(kid, modelName);
// 根据条件删除向量数据
Filter simpleFilterByKid = new IsEqualTo("kid", kid);
Filter simpleFilterFid = new IsEqualTo("fid", fid);
Filter simpleFilterByAnd = Filter.and(simpleFilterFid, simpleFilterByKid);
embeddingStore.removeAll(simpleFilterByAnd);
embeddingStore.remove(id);
}
/**

View File

@@ -40,7 +40,6 @@ public class ChatMessageController extends BaseController {
/**
* 查询聊天消息列表
*/
@SaCheckPermission("system:message:list")
@GetMapping("/list")
public TableDataInfo<ChatMessageVo> list(ChatMessageBo bo, PageQuery pageQuery) {
return chatMessageService.queryPageList(bo, pageQuery);
@@ -49,7 +48,6 @@ public class ChatMessageController extends BaseController {
/**
* 导出聊天消息列表
*/
@SaCheckPermission("system:message:export")
@Log(title = "聊天消息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(ChatMessageBo bo, HttpServletResponse response) {
@@ -62,7 +60,6 @@ public class ChatMessageController extends BaseController {
*
* @param id 主键
*/
@SaCheckPermission("system:message:query")
@GetMapping("/{id}")
public R<ChatMessageVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
@@ -72,7 +69,6 @@ public class ChatMessageController extends BaseController {
/**
* 新增聊天消息
*/
@SaCheckPermission("system:message:add")
@Log(title = "聊天消息", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
@@ -84,7 +80,6 @@ public class ChatMessageController extends BaseController {
/**
* 修改聊天消息
*/
@SaCheckPermission("system:message:edit")
@Log(title = "聊天消息", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
@@ -97,7 +92,6 @@ public class ChatMessageController extends BaseController {
*
* @param ids 主键串
*/
@SaCheckPermission("system:message:remove")
@Log(title = "聊天消息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")

View File

@@ -41,7 +41,6 @@ public class ChatSessionController extends BaseController {
/**
* 查询会话管理列表
*/
@SaCheckPermission("system:session:list")
@GetMapping("/list")
public TableDataInfo<ChatSessionVo> list(ChatSessionBo bo, PageQuery pageQuery) {
if(!LoginHelper.isLogin()){
@@ -56,7 +55,6 @@ public class ChatSessionController extends BaseController {
/**
* 导出会话管理列表
*/
@SaCheckPermission("system:session:export")
@Log(title = "会话管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(ChatSessionBo bo, HttpServletResponse response) {
@@ -69,7 +67,6 @@ public class ChatSessionController extends BaseController {
*
* @param id 主键
*/
@SaCheckPermission("system:session:query")
@GetMapping("/{id}")
public R<ChatSessionVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
@@ -79,7 +76,6 @@ public class ChatSessionController extends BaseController {
/**
* 新增会话管理
*/
@SaCheckPermission("system:session:add")
@Log(title = "会话管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
@@ -92,7 +88,6 @@ public class ChatSessionController extends BaseController {
/**
* 修改会话管理
*/
@SaCheckPermission("system:session:edit")
@Log(title = "会话管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
@@ -105,7 +100,6 @@ public class ChatSessionController extends BaseController {
*
* @param ids 主键串
*/
@SaCheckPermission("system:session:remove")
@Log(title = "会话管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")

View File

@@ -177,13 +177,11 @@ public class KnowledgeInfoServiceImpl implements IKnowledgeInfoService {
@Transactional(rollbackFor = Exception.class)
public void removeKnowledge(String id) {
Map<String,Object> map = new HashMap<>();
map.put("kid",id);
List<KnowledgeInfoVo> knowledgeInfoList = baseMapper.selectVoByMap(map);
check(knowledgeInfoList);
// 删除向量库信息
// knowledgeInfoList.forEach(knowledgeInfoVo -> {
// vectorStoreService.removeByKid(String.valueOf(knowledgeInfoVo.getId()),knowledgeInfoVo.getVectorModelName());
// });
KnowledgeInfo knowledgeInfo = baseMapper.selectById(id);
check(knowledgeInfo);
map.put("kid",knowledgeInfo.getKid());
// 删除向量数据
vectorStoreService.removeById(String.valueOf(knowledgeInfo.getId()),knowledgeInfo.getVectorModelName());
// 删除附件和知识片段
fragmentMapper.deleteByMap(map);
attachMapper.deleteByMap(map);
@@ -256,14 +254,12 @@ public class KnowledgeInfoServiceImpl implements IKnowledgeInfoService {
/**
* 检查用户是否有删除知识库权限
*
* @param knowledgeInfoList 知识库列表
* @param knowledgeInfo 知识库
*/
public void check(List<KnowledgeInfoVo> knowledgeInfoList) {
public void check( KnowledgeInfo knowledgeInfo) {
LoginUser loginUser = LoginHelper.getLoginUser();
for (KnowledgeInfoVo knowledgeInfoVo : knowledgeInfoList) {
if (!knowledgeInfoVo.getUid().equals(loginUser.getUserId())) {
throw new SecurityException("权限不足");
}
if (!knowledgeInfo.getUid().equals(loginUser.getUserId())) {
throw new SecurityException("权限不足");
}
}

View File

@@ -1,6 +1,4 @@
#!/bin/bash
rm -f /root/ruoyi-ai-docker/deploy/mysql-init/*.sql
cp /root/ruoyi-ai-docker/source-code/ruoyi-ai-backend/script/sql/ruoyi-ai.sql /root/ruoyi-ai-docker/deploy/mysql-init/01_ruoyi-ai.sql
cp /root/ruoyi-ai-docker/source-code/ruoyi-ai-backend/script/sql/update/20250407.sql /root/ruoyi-ai-docker/deploy/mysql-init/02_update_20250407.sql
cp /root/ruoyi-ai-docker/source-code/ruoyi-ai-backend/script/sql/update/20250505.sql /root/ruoyi-ai-docker/deploy/mysql-init/03_update_20250505.sql
cp /root/ruoyi-ai-docker/source-code/ruoyi-ai-backend/script/sql/update/20250509.sql /root/ruoyi-ai-docker/deploy/mysql-init/04_update_20250509.sql
cp /root/ruoyi-ai-docker/source-code/ruoyi-ai-backend/script/sql/ruoyi-ai.sql /root/ruoyi-ai-docker/deploy/mysql-init/ruoyi-ai.sql

View File

@@ -1,4 +0,0 @@
INSERT INTO `chat_model` (`id`, `tenant_id`, `category`, `model_name`, `model_describe`, `model_price`, `model_type`, `model_show`, `system_prompt`, `api_host`, `api_key`, `create_dept`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1907575746601119746, '000000', 'vector', 'text-embedding-3-small', 'text-embedding-3-small', 0, '2', '0', NULL, 'https://api.pandarobot.chat/', 'sk-cdBlIaZcufccm2RaDe547cBd054d49C7B0782eCa72A0052b', 103, 1, '2025-04-03 07:27:54', 1, '2025-04-03 07:27:54', 'text-embedding-3-small');
INSERT INTO `chat_model` (`id`, `tenant_id`, `category`, `model_name`, `model_describe`, `model_price`, `model_type`, `model_show`, `system_prompt`, `api_host`, `api_key`, `create_dept`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1907576007017066497, '000000', 'vector', 'quentinz/bge-large-zh-v1.5', 'bge-large-zh-v1.5', 0, '2', '0', NULL, 'http://127.0.0.1:11434/', 'cdBlIaZcufccm2RaDe547cBd054d49C7B0782eCa72A0052b', 103, 1, '2025-04-03 07:28:56', 1, '2025-04-03 07:28:56', 'bge-large-zh-v1.5');
INSERT INTO `chat_model` (`id`, `tenant_id`, `category`, `model_name`, `model_describe`, `model_price`, `model_type`, `model_show`, `system_prompt`, `api_host`, `api_key`, `create_dept`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1907576806191362049, '000000', 'vector', 'nomic-embed-text', 'nomic-embed-text', 0, '2', '0', NULL, 'http://127.0.0.1:11434/', 'nomic-embed-text', 103, 1, '2025-04-03 07:32:06', 1, '2025-04-03 07:32:06', 'nomic-embed-text');
INSERT INTO `chat_model` (`id`, `tenant_id`, `category`, `model_name`, `model_describe`, `model_price`, `model_type`, `model_show`, `system_prompt`, `api_host`, `api_key`, `create_dept`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1907577073490161665, '000000', 'vector', 'snowflake-arctic-embed', 'snowflake-arctic-embed', 0, '2', '0', NULL, 'http://127.0.0.1:11434/', 'snowflake-arctic-embed', 103, 1, '2025-04-03 07:33:10', 1, '2025-04-03 07:33:10', 'snowflake-arctic-embed');

View File

@@ -1,42 +0,0 @@
/*
Navicat MySQL Data Transfer
Source Server : 129.211.24.7
Source Server Type : MySQL
Source Server Version : 50744
Source Host : 129.211.24.7:3306
Source Schema : ry-vue
Target Server Type : MySQL
Target Server Version : 50744
File Encoding : 65001
Date: 05/05/2025 15:01:08
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for chat_session
-- ----------------------------
DROP TABLE IF EXISTS `chat_session`;
CREATE TABLE `chat_session` (
`id` bigint(20) NOT NULL COMMENT '主键',
`user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id',
`session_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会话标题',
`session_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '会话内容',
`create_dept` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门',
`create_by` bigint(20) NULL DEFAULT NULL COMMENT '创建者',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_by` bigint(20) NULL DEFAULT NULL COMMENT '更新者',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会话管理' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
ALTER TABLE `chat_message`
ADD COLUMN `session_id` bigint(20) NULL COMMENT '会话id' AFTER `id`;

View File

@@ -1,4 +0,0 @@
ALTER TABLE `chat_model`
ADD COLUMN `api_url` varchar(50) NULL COMMENT '请求后缀' AFTER `api_key`;
INSERT INTO `chat_config` (`id`, `category`, `config_name`, `config_value`, `config_dict`, `create_dept`, `create_time`, `create_by`, `update_by`, `update_time`, `remark`, `version`, `del_flag`, `update_ip`, `tenant_id`) VALUES (1779450794872414211, 'chat', 'apiUrl', 'v1/chat/completions', 'API 请求后缀', 103, '2024-04-14 18:05:05', '1', '1', '2025-04-23 22:29:04', NULL, NULL, '0', NULL, 0);

View File

@@ -1,2 +1,2 @@
#!/bin/bash
sed -i 's#127.0.0.1:6038#weaviate:8080#g' ./mysql-init/01_ruoyi-ai.sql
sed -i 's#127.0.0.1:6038#weaviate:8080#g' ./mysql-init/ruoyi-ai.sql

View File

@@ -493,9 +493,9 @@ cp -pr ${SCRIPT_DIR}/mysql-init ${DEPLOY_DIR}/
# 使用配置值更新 SQL 文件
echo "正在更新 SQL 配置值..."
sed -i "s|'weaviate', 'host', '127.0.0.1:6038'|'weaviate', 'host', 'weaviate:8080'|g" ${DEPLOY_DIR}/mysql-init/01_ruoyi-ai.sql
sed -i "s|'weaviate', 'protocol', 'http'|'weaviate', 'protocol', '${WEAVIATE_PROTOCOL}'|g" ${DEPLOY_DIR}/mysql-init/01_ruoyi-ai.sql
sed -i "s|'weaviate', 'classname', 'LocalKnowledge'|'weaviate', 'classname', '${WEAVIATE_CLASSNAME}'|g" ${DEPLOY_DIR}/mysql-init/01_ruoyi-ai.sql
sed -i "s|'weaviate', 'host', '127.0.0.1:6038'|'weaviate', 'host', 'weaviate:8080'|g" ${DEPLOY_DIR}/mysql-init/ruoyi-ai.sql
sed -i "s|'weaviate', 'protocol', 'http'|'weaviate', 'protocol', '${WEAVIATE_PROTOCOL}'|g" ${DEPLOY_DIR}/mysql-init/ruoyi-ai.sql
sed -i "s|'weaviate', 'classname', 'LocalKnowledge'|'weaviate', 'classname', '${WEAVIATE_CLASSNAME}'|g" ${DEPLOY_DIR}/mysql-init/ruoyi-ai.sql
# 使用 Docker Compose 部署
echo "正在使用 Docker Compose 进行部署..."

View File

@@ -493,9 +493,9 @@ cp -pr ${SCRIPT_DIR}/mysql-init ${DEPLOY_DIR}/
# Update SQL file with configuration values
echo "Updating SQL configuration values..."
sed -i "s|'weaviate', 'host', '127.0.0.1:6038'|'weaviate', 'host', 'weaviate:8080'|g" ${DEPLOY_DIR}/mysql-init/01_ruoyi-ai.sql
sed -i "s|'weaviate', 'protocol', 'http'|'weaviate', 'protocol', '${WEAVIATE_PROTOCOL}'|g" ${DEPLOY_DIR}/mysql-init/01_ruoyi-ai.sql
sed -i "s|'weaviate', 'classname', 'LocalKnowledge'|'weaviate', 'classname', '${WEAVIATE_CLASSNAME}'|g" ${DEPLOY_DIR}/mysql-init/01_ruoyi-ai.sql
sed -i "s|'weaviate', 'host', '127.0.0.1:6038'|'weaviate', 'host', 'weaviate:8080'|g" ${DEPLOY_DIR}/mysql-init/ruoyi-ai.sql
sed -i "s|'weaviate', 'protocol', 'http'|'weaviate', 'protocol', '${WEAVIATE_PROTOCOL}'|g" ${DEPLOY_DIR}/mysql-init/ruoyi-ai.sql
sed -i "s|'weaviate', 'classname', 'LocalKnowledge'|'weaviate', 'classname', '${WEAVIATE_CLASSNAME}'|g" ${DEPLOY_DIR}/mysql-init/ruoyi-ai.sql
# Deploy using Docker Compose
echo "Deploying with Docker Compose..."

View File

@@ -1,4 +0,0 @@
INSERT INTO `chat_model` (`id`, `tenant_id`, `category`, `model_name`, `model_describe`, `model_price`, `model_type`, `model_show`, `system_prompt`, `api_host`, `api_key`, `create_dept`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1907575746601119746, '000000', 'vector', 'text-embedding-3-small', 'text-embedding-3-small', 0, '2', '0', NULL, 'https://api.pandarobot.chat/', 'sk-cdBlIaZcufccm2RaDe547cBd054d49C7B0782eCa72A0052b', 103, 1, '2025-04-03 07:27:54', 1, '2025-04-03 07:27:54', 'text-embedding-3-small');
INSERT INTO `chat_model` (`id`, `tenant_id`, `category`, `model_name`, `model_describe`, `model_price`, `model_type`, `model_show`, `system_prompt`, `api_host`, `api_key`, `create_dept`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1907576007017066497, '000000', 'vector', 'quentinz/bge-large-zh-v1.5', 'bge-large-zh-v1.5', 0, '2', '0', NULL, 'http://127.0.0.1:11434/', 'cdBlIaZcufccm2RaDe547cBd054d49C7B0782eCa72A0052b', 103, 1, '2025-04-03 07:28:56', 1, '2025-04-03 07:28:56', 'bge-large-zh-v1.5');
INSERT INTO `chat_model` (`id`, `tenant_id`, `category`, `model_name`, `model_describe`, `model_price`, `model_type`, `model_show`, `system_prompt`, `api_host`, `api_key`, `create_dept`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1907576806191362049, '000000', 'vector', 'nomic-embed-text', 'nomic-embed-text', 0, '2', '0', NULL, 'http://127.0.0.1:11434/', 'nomic-embed-text', 103, 1, '2025-04-03 07:32:06', 1, '2025-04-03 07:32:06', 'nomic-embed-text');
INSERT INTO `chat_model` (`id`, `tenant_id`, `category`, `model_name`, `model_describe`, `model_price`, `model_type`, `model_show`, `system_prompt`, `api_host`, `api_key`, `create_dept`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1907577073490161665, '000000', 'vector', 'snowflake-arctic-embed', 'snowflake-arctic-embed', 0, '2', '0', NULL, 'http://127.0.0.1:11434/', 'snowflake-arctic-embed', 103, 1, '2025-04-03 07:33:10', 1, '2025-04-03 07:33:10', 'snowflake-arctic-embed');

View File

@@ -1,42 +0,0 @@
/*
Navicat MySQL Data Transfer
Source Server : 129.211.24.7
Source Server Type : MySQL
Source Server Version : 50744
Source Host : 129.211.24.7:3306
Source Schema : ry-vue
Target Server Type : MySQL
Target Server Version : 50744
File Encoding : 65001
Date: 05/05/2025 15:01:08
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for chat_session
-- ----------------------------
DROP TABLE IF EXISTS `chat_session`;
CREATE TABLE `chat_session` (
`id` bigint(20) NOT NULL COMMENT '主键',
`user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id',
`session_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会话标题',
`session_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '会话内容',
`create_dept` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门',
`create_by` bigint(20) NULL DEFAULT NULL COMMENT '创建者',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_by` bigint(20) NULL DEFAULT NULL COMMENT '更新者',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会话管理' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
ALTER TABLE `chat_message`
ADD COLUMN `session_id` bigint(20) NULL COMMENT '会话id' AFTER `id`;

View File

@@ -1,4 +0,0 @@
ALTER TABLE `chat_model`
ADD COLUMN `api_url` varchar(50) NULL COMMENT '请求后缀' AFTER `api_key`;
INSERT INTO `chat_config` (`id`, `category`, `config_name`, `config_value`, `config_dict`, `create_dept`, `create_time`, `create_by`, `update_by`, `update_time`, `remark`, `version`, `del_flag`, `update_ip`, `tenant_id`) VALUES (1779450794872414211, 'chat', 'apiUrl', 'v1/chat/completions', 'API 请求后缀', 103, '2024-04-14 18:05:05', '1', '1', '2025-04-23 22:29:04', NULL, NULL, '0', NULL, 0);