feat: 添加.gitignore文件并清理编译产物
🔧 新增功能: - 添加完整的.gitignore文件,覆盖所有编译产物和临时文件 - 从Git跟踪中移除Maven target目录下的编译产物 - 从Git跟踪中移除日志文件和临时文件 📁 忽略文件类型: - Maven编译产物 (target/**, *.jar, *.war等) - 日志文件 (logs/, *.log, *.log.*) - IDE文件 (.idea/, *.iml, .vscode/等) - Node.js文件 (node_modules/, dist/, .env等) - 操作系统文件 (.DS_Store, Thumbs.db等) - 临时文件 (*.tmp, *.bak, *.swp等) - 部署包 (packages/, *.tar.gz, *.zip等) ✨ 优化效果: - 减少仓库大小,提高克隆速度 - 避免提交不必要的编译产物 - 保持仓库整洁,只包含源代码 - 防止敏感配置文件意外提交
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: localhost:8848
|
||||
namespace:
|
||||
group: DEFAULT_GROUP
|
||||
enabled: true
|
||||
config:
|
||||
server-addr: localhost:8848
|
||||
namespace:
|
||||
group: DEFAULT_GROUP
|
||||
file-extension: yml
|
||||
enabled: false
|
||||
|
||||
# Feign配置
|
||||
feign:
|
||||
client:
|
||||
config:
|
||||
default:
|
||||
connect-timeout: 5000
|
||||
read-timeout: 10000
|
||||
logger-level: basic
|
||||
httpclient:
|
||||
enabled: true
|
||||
max-connections: 200
|
||||
max-connections-per-route: 50
|
||||
|
||||
# WebSocket配置
|
||||
websocket:
|
||||
allowed-origins: "*"
|
||||
heartbeat-interval: 30000
|
||||
max-session-idle-timeout: 300000
|
||||
@@ -1,86 +0,0 @@
|
||||
server:
|
||||
port: 19007
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: emotion-websocket
|
||||
profiles:
|
||||
active: ${SPRING_PROFILES_ACTIVE:local}
|
||||
|
||||
# 数据源配置
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/emotion_museum?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: EmotionMuseum2025*#
|
||||
druid:
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
max-active: 20
|
||||
max-wait: 60000
|
||||
time-between-eviction-runs-millis: 60000
|
||||
min-evictable-idle-time-millis: 300000
|
||||
validation-query: SELECT 1 FROM DUAL
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
pool-prepared-statements: true
|
||||
max-pool-prepared-statement-per-connection-size: 20
|
||||
filters: stat,wall,slf4j
|
||||
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
|
||||
|
||||
# Redis配置
|
||||
redis:
|
||||
host: localhost
|
||||
port: 6379
|
||||
password:
|
||||
database: 0
|
||||
timeout: 5000ms
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 20
|
||||
max-idle: 10
|
||||
min-idle: 0
|
||||
max-wait: -1ms
|
||||
|
||||
# MyBatis Plus配置
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
cache-enabled: false
|
||||
call-setters-on-nulls: true
|
||||
jdbc-type-for-null: 'null'
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: ASSIGN_ID
|
||||
logic-delete-field: is_deleted
|
||||
logic-delete-value: 1
|
||||
logic-not-delete-value: 0
|
||||
mapper-locations: classpath*:mapper/**/*Mapper.xml
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.emotionmuseum.websocket: DEBUG
|
||||
org.springframework.web.socket: DEBUG
|
||||
org.springframework.messaging: DEBUG
|
||||
pattern:
|
||||
console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n"
|
||||
file: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n"
|
||||
file:
|
||||
name: logs/emotion-websocket.log
|
||||
|
||||
# 监控配置
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,metrics,prometheus
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
metrics:
|
||||
export:
|
||||
prometheus:
|
||||
enabled: true
|
||||
@@ -1,17 +0,0 @@
|
||||
spring:
|
||||
application:
|
||||
name: emotion-websocket
|
||||
profiles:
|
||||
active: ${SPRING_PROFILES_ACTIVE:local}
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
|
||||
namespace: ${NACOS_NAMESPACE:}
|
||||
group: ${NACOS_GROUP:DEFAULT_GROUP}
|
||||
config:
|
||||
server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
|
||||
namespace: ${NACOS_NAMESPACE:}
|
||||
group: ${NACOS_GROUP:DEFAULT_GROUP}
|
||||
file-extension: yml
|
||||
enabled: false
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -1,270 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>WebSocket聊天测试</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.container {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
.status {
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.status.connected {
|
||||
background-color: #d4edda;
|
||||
color: #155724;
|
||||
border: 1px solid #c3e6cb;
|
||||
}
|
||||
.status.disconnected {
|
||||
background-color: #f8d7da;
|
||||
color: #721c24;
|
||||
border: 1px solid #f5c6cb;
|
||||
}
|
||||
.chat-container {
|
||||
height: 400px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
overflow-y: auto;
|
||||
background-color: #fafafa;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.message {
|
||||
margin-bottom: 10px;
|
||||
padding: 8px 12px;
|
||||
border-radius: 4px;
|
||||
max-width: 70%;
|
||||
}
|
||||
.message.user {
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
margin-left: auto;
|
||||
text-align: right;
|
||||
}
|
||||
.message.ai {
|
||||
background-color: #e9ecef;
|
||||
color: #333;
|
||||
}
|
||||
.message.system {
|
||||
background-color: #fff3cd;
|
||||
color: #856404;
|
||||
text-align: center;
|
||||
max-width: 100%;
|
||||
}
|
||||
.message.error {
|
||||
background-color: #f8d7da;
|
||||
color: #721c24;
|
||||
text-align: center;
|
||||
max-width: 100%;
|
||||
}
|
||||
.input-container {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
.input-container input {
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.input-container button {
|
||||
padding: 10px 20px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.input-container button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
.input-container button:disabled {
|
||||
background-color: #6c757d;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.controls {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.controls button {
|
||||
margin-right: 10px;
|
||||
padding: 8px 16px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
background: white;
|
||||
cursor: pointer;
|
||||
}
|
||||
.controls button:hover {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>WebSocket聊天测试</h1>
|
||||
|
||||
<div id="status" class="status disconnected">未连接</div>
|
||||
|
||||
<div class="controls">
|
||||
<button onclick="connect()">连接</button>
|
||||
<button onclick="disconnect()">断开连接</button>
|
||||
<button onclick="clearMessages()">清空消息</button>
|
||||
<input type="text" id="userId" placeholder="用户ID (默认: test-user)" value="test-user">
|
||||
</div>
|
||||
|
||||
<div id="messages" class="chat-container"></div>
|
||||
|
||||
<div class="input-container">
|
||||
<input type="text" id="messageInput" placeholder="输入消息..." onkeypress="handleKeyPress(event)">
|
||||
<button onclick="sendMessage()" id="sendButton" disabled>发送</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/sockjs-client@1.6.1/dist/sockjs.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/stompjs@2.3.3/lib/stomp.min.js"></script>
|
||||
<script>
|
||||
let stompClient = null;
|
||||
let connected = false;
|
||||
|
||||
function connect() {
|
||||
const userId = document.getElementById('userId').value || 'test-user';
|
||||
const socket = new SockJS('http://localhost:19007/ws/chat');
|
||||
stompClient = Stomp.over(socket);
|
||||
|
||||
stompClient.connect({}, function (frame) {
|
||||
console.log('Connected: ' + frame);
|
||||
connected = true;
|
||||
updateStatus('已连接', true);
|
||||
document.getElementById('sendButton').disabled = false;
|
||||
|
||||
// 订阅用户消息
|
||||
stompClient.subscribe('/user/queue/messages', function (message) {
|
||||
const messageData = JSON.parse(message.body);
|
||||
displayMessage(messageData);
|
||||
});
|
||||
|
||||
// 订阅广播消息
|
||||
stompClient.subscribe('/topic/broadcast', function (message) {
|
||||
const messageData = JSON.parse(message.body);
|
||||
displayMessage(messageData);
|
||||
});
|
||||
|
||||
// 发送连接消息
|
||||
stompClient.send("/app/chat.connect", {}, JSON.stringify({}));
|
||||
|
||||
}, function (error) {
|
||||
console.log('Connection error: ' + error);
|
||||
updateStatus('连接失败: ' + error, false);
|
||||
});
|
||||
}
|
||||
|
||||
function disconnect() {
|
||||
if (stompClient !== null) {
|
||||
stompClient.send("/app/chat.disconnect", {}, JSON.stringify({}));
|
||||
stompClient.disconnect();
|
||||
}
|
||||
connected = false;
|
||||
updateStatus('已断开连接', false);
|
||||
document.getElementById('sendButton').disabled = true;
|
||||
console.log("Disconnected");
|
||||
}
|
||||
|
||||
function sendMessage() {
|
||||
const messageInput = document.getElementById('messageInput');
|
||||
const message = messageInput.value.trim();
|
||||
const userId = document.getElementById('userId').value || 'test-user';
|
||||
|
||||
if (message && connected) {
|
||||
const chatRequest = {
|
||||
content: message,
|
||||
senderId: userId,
|
||||
senderType: 'USER',
|
||||
messageType: 'TEXT',
|
||||
conversationId: 'test-conversation-' + userId
|
||||
};
|
||||
|
||||
stompClient.send("/app/chat.send", {}, JSON.stringify(chatRequest));
|
||||
messageInput.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
function displayMessage(messageData) {
|
||||
const messagesDiv = document.getElementById('messages');
|
||||
const messageDiv = document.createElement('div');
|
||||
messageDiv.className = 'message';
|
||||
|
||||
// 根据发送者类型设置样式
|
||||
switch (messageData.senderType) {
|
||||
case 'USER':
|
||||
messageDiv.className += ' user';
|
||||
break;
|
||||
case 'AI':
|
||||
messageDiv.className += ' ai';
|
||||
break;
|
||||
case 'SYSTEM':
|
||||
messageDiv.className += ' system';
|
||||
break;
|
||||
default:
|
||||
messageDiv.className += ' system';
|
||||
}
|
||||
|
||||
// 根据消息类型设置样式
|
||||
if (messageData.type === 'ERROR') {
|
||||
messageDiv.className = 'message error';
|
||||
}
|
||||
|
||||
// 设置消息内容
|
||||
let content = messageData.content;
|
||||
if (messageData.createTime) {
|
||||
content += ' <small>(' + messageData.createTime + ')</small>';
|
||||
}
|
||||
|
||||
messageDiv.innerHTML = content;
|
||||
messagesDiv.appendChild(messageDiv);
|
||||
messagesDiv.scrollTop = messagesDiv.scrollHeight;
|
||||
}
|
||||
|
||||
function updateStatus(message, isConnected) {
|
||||
const statusDiv = document.getElementById('status');
|
||||
statusDiv.textContent = message;
|
||||
statusDiv.className = 'status ' + (isConnected ? 'connected' : 'disconnected');
|
||||
}
|
||||
|
||||
function clearMessages() {
|
||||
document.getElementById('messages').innerHTML = '';
|
||||
}
|
||||
|
||||
function handleKeyPress(event) {
|
||||
if (event.key === 'Enter') {
|
||||
sendMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// 页面加载完成后自动连接
|
||||
window.onload = function() {
|
||||
// 可以在这里自动连接
|
||||
// connect();
|
||||
};
|
||||
|
||||
// 页面关闭时断开连接
|
||||
window.onbeforeunload = function() {
|
||||
if (connected) {
|
||||
disconnect();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
com/emotionmuseum/websocket/service/ChatWebSocketService.class
|
||||
com/emotionmuseum/websocket/feign/AiServiceClient.class
|
||||
com/emotionmuseum/websocket/controller/WebSocketTestController.class
|
||||
com/emotionmuseum/websocket/config/WebSocketConfig.class
|
||||
com/emotionmuseum/websocket/dto/WebSocketMessage$SenderType.class
|
||||
com/emotionmuseum/websocket/manager/WebSocketSessionManager$SessionInfo.class
|
||||
com/emotionmuseum/websocket/dto/ChatRequest.class
|
||||
com/emotionmuseum/websocket/service/impl/AiChatServiceImpl.class
|
||||
com/emotionmuseum/websocket/dto/WebSocketMessage$MessageType.class
|
||||
com/emotionmuseum/websocket/service/impl/ChatWebSocketServiceImpl.class
|
||||
com/emotionmuseum/websocket/service/AiChatService.class
|
||||
com/emotionmuseum/websocket/dto/ChatRequest$ChatRequestBuilder.class
|
||||
com/emotionmuseum/websocket/manager/WebSocketSessionManager.class
|
||||
com/emotionmuseum/websocket/dto/WebSocketMessage$MessageStatus.class
|
||||
com/emotionmuseum/websocket/dto/WebSocketMessage.class
|
||||
com/emotionmuseum/websocket/dto/WebSocketMessage$WebSocketMessageBuilder.class
|
||||
com/emotionmuseum/websocket/listener/WebSocketEventListener.class
|
||||
com/emotionmuseum/websocket/config/AsyncConfig.class
|
||||
com/emotionmuseum/websocket/WebsocketApplication.class
|
||||
com/emotionmuseum/websocket/controller/ChatWebSocketController.class
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/feign/AiServiceClient.java
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/service/AiChatService.java
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/service/ChatWebSocketService.java
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/controller/WebSocketTestController.java
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/WebsocketApplication.java
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/dto/WebSocketMessage.java
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/config/AsyncConfig.java
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/service/impl/ChatWebSocketServiceImpl.java
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/manager/WebSocketSessionManager.java
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/controller/ChatWebSocketController.java
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/listener/WebSocketEventListener.java
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/dto/ChatRequest.java
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/config/WebSocketConfig.java
|
||||
/Users/huazhongmin/peanut/AppleDevelop/EmotionMuseum/backend/emotion-websocket/src/main/java/com/emotionmuseum/websocket/service/impl/AiChatServiceImpl.java
|
||||
Reference in New Issue
Block a user