Commit f334acf4 authored by 赵灿灿's avatar 赵灿灿

修改配置

parent 94111bc4
Pipeline #21078 passed with stages
in 3 minutes and 15 seconds
...@@ -378,9 +378,7 @@ public class LangChainController { ...@@ -378,9 +378,7 @@ public class LangChainController {
chatService.updateMessage(messagesContent); chatService.updateMessage(messagesContent);
if (connection != null) { if (connection != null) {
connection.disconnect(); connection.disconnect();
logger.info("关闭成功1");
} }
logger.info("关闭成功2");
} }
}).start(); }).start();
...@@ -754,4 +752,18 @@ public class LangChainController { ...@@ -754,4 +752,18 @@ public class LangChainController {
List<Messages> mapList= chatService.conversationMessages(sessionId); List<Messages> mapList= chatService.conversationMessages(sessionId);
return Result.successData(mapList); return Result.successData(mapList);
} }
//删除历史对话
/**
* 会话记录列表
*
* @param
* @return
*/
@PostMapping("/deleteChat")
public Result deleteChat(@RequestBody String sessionId) {
chatService.deleteChat(sessionId);
return Result.successData("删除成功");
}
} }
...@@ -284,6 +284,17 @@ public class ChatService { ...@@ -284,6 +284,17 @@ public class ChatService {
return messagesList; return messagesList;
} }
//删除会话内容通过会话id
public void deleteChat(String sessionId)
{
try {
iMessagesRepository.deleteBySessionId(sessionId);
iConversationsRepository.deleteBySessionId(sessionId);
} catch (Exception e) {
e.printStackTrace();
}
}
public Date getToday() public Date getToday()
{ {
......
...@@ -41,7 +41,11 @@ public interface IConversationsRepository { ...@@ -41,7 +41,11 @@ public interface IConversationsRepository {
* @param: [id] * @param: [id]
*/ */
boolean delete(String id); boolean delete(String id);
/**
* 删除
* @param: [id]
*/
boolean deleteBySessionId(String sessionId);
// region select // region select
/** /**
......
...@@ -41,6 +41,12 @@ public interface IMessagesRepository { ...@@ -41,6 +41,12 @@ public interface IMessagesRepository {
*/ */
boolean delete(String id); boolean delete(String id);
/**
* 删除
* @param: [id]
*/
boolean deleteBySessionId(String sessionId);
// region select // region select
/** /**
......
...@@ -154,6 +154,21 @@ public class ConversationsRepository implements IConversationsRepository { ...@@ -154,6 +154,21 @@ public class ConversationsRepository implements IConversationsRepository {
return result > 0; return result > 0;
} }
/**
* 删除
*/
@Override
public boolean deleteBySessionId(String sessionId) {
String sql = "DELETE FROM T_CONVERSATIONS WHERE C_SESSION_ID = ?";
int result=0;
try {
result = jdbcTemplate.update(sql, sessionId);
} catch (Exception e) {
LogHelper.info(e.getMessage());
//throw new ServiceException("删除 数据 失败。");
}
return result > 0;
}
/** /**
* 根据Id查询 * 根据Id查询
*/ */
......
...@@ -151,6 +151,22 @@ public class MessagesRepository implements IMessagesRepository { ...@@ -151,6 +151,22 @@ public class MessagesRepository implements IMessagesRepository {
return result > 0; return result > 0;
} }
/**
* 删除
*/
@Override
public boolean deleteBySessionId(String sessionId) {
String sql = "DELETE FROM T_MESSAGES WHERE M_SESSION_ID = ?";
int result=0;
try {
result = jdbcTemplate.update(sql, sessionId);
} catch (Exception e) {
LogHelper.info(e.getMessage());
//throw new ServiceException("删除 数据 失败。");
}
return result > 0;
}
/** /**
* 根据Id查询 * 根据Id查询
*/ */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>AI智能对话</title> <title>推荐专家智能助手</title>
<link rel="stylesheet" href="style/ai-chat.css"> <link rel="stylesheet" href="style/ai-chat.css">
<style> <style>
[v-cloak] { [v-cloak] {
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<!-- 左侧历史对话列表 --> <!-- 左侧历史对话列表 -->
<div class="sidebar"> <div class="sidebar">
<div class="sidebar-header"> <div class="sidebar-header">
<h1>专家推荐智能助手</h1> <h1>推荐专家智能助手</h1>
<!-- 添加主题切换按钮 --> <!-- 添加主题切换按钮 -->
<div id="theme-toggle" class="theme-toggle" title="切换主题" @click="toggleTheme"> <div id="theme-toggle" class="theme-toggle" title="切换主题" @click="toggleTheme">
<svg id="light-icon" viewBox="0 0 24 24" :style="{display: isDarkTheme ? 'block' : 'none'}"> <svg id="light-icon" viewBox="0 0 24 24" :style="{display: isDarkTheme ? 'block' : 'none'}">
......
...@@ -233,7 +233,7 @@ require(['jquery', 'vue', 'utils','marked','markdown', 'global'], function ($, V ...@@ -233,7 +233,7 @@ require(['jquery', 'vue', 'utils','marked','markdown', 'global'], function ($, V
const data = JSON.parse(event.data); const data = JSON.parse(event.data);
const content = data.dataToSend[1].data; const content = data.dataToSend[1].data;
if (content !== "stop") { if (content !== "stop") {
const match = content.match(/SUGGEST#\[(.*?)\]#SUGGEST/); const match = content.match(/SUGGEST\[(.*?)\]SUGGEST/);
if (match) { if (match) {
const suggestionsJson = `[${match[1]}]`; const suggestionsJson = `[${match[1]}]`;
const suggestions = JSON.parse(suggestionsJson); const suggestions = JSON.parse(suggestionsJson);
...@@ -372,6 +372,16 @@ require(['jquery', 'vue', 'utils','marked','markdown', 'global'], function ($, V ...@@ -372,6 +372,16 @@ require(['jquery', 'vue', 'utils','marked','markdown', 'global'], function ($, V
if (isActiveChat) { if (isActiveChat) {
this.clearChat(); this.clearChat();
} }
$.ajax({
url: "../../api/langchain/deleteChat",
type: "post",
dataType: "json",
contentType: "application/json;charset=UTF-8",
data: chatId,
async: false,
success: function (data) {
}
});
}, },
// 专家选择相关方法 // 专家选择相关方法
toggleExpertDropdown() { toggleExpertDropdown() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment