注释掉一些日志打印

This commit is contained in:
zqc
2026-01-22 09:57:45 +08:00
parent 8837266e92
commit b555035349

View File

@@ -325,14 +325,18 @@
ws.onmessage = (event) => { ws.onmessage = (event) => {
try { try {
// console.log('收到WebSocket消息:', event.data);
const msg = JSON.parse(event.data); const msg = JSON.parse(event.data);
// console.log('解析后的消息对象:', msg);
if (msg.msg_type === 'frame') { if (msg.msg_type === 'frame') {
// console.log('处理frame类型消息');
if (msg.image_base64) { if (msg.image_base64) {
liveImage.src = `data:image/jpeg;base64,${msg.image_base64}`; liveImage.src = `data:image/jpeg;base64,${msg.image_base64}`;
} }
currentDetectedActions = msg.result_type || []; currentDetectedActions = msg.result_type || [];
// console.log('检测到的动作:', currentDetectedActions);
if (currentDetectedActions.length > 0) { if (currentDetectedActions.length > 0) {
const actionText = currentDetectedActions.join(', '); const actionText = currentDetectedActions.join(', ');
@@ -358,13 +362,18 @@
if (!existingAlert) { if (!existingAlert) {
alerts.push(alertMsg); alerts.push(alertMsg);
// console.log('添加新的异常告警:', alertMsg);
// console.log('当前alerts数组长度:', alerts.length);
renderMessages(); renderMessages();
// console.log('渲染消息列表完成');
const alertTypes = alertMsg.result_type.join(', '); const alertTypes = alertMsg.result_type.join(', ');
addLog(`检测到异常: ${alertTypes}`, 'warning'); addLog(`检测到异常: ${alertTypes}`, 'warning');
} }
}
} else if (msg.msg_type === 'take_out') { } else if (msg.msg_type === 'take_out') {
// console.log('处理take_out类型消息');
// 处理take_out类型的消息 // 处理take_out类型的消息
const takeOutMsg = { const takeOutMsg = {
msg_type: 'take_out', msg_type: 'take_out',
@@ -373,14 +382,20 @@
timestamp: Math.floor(Date.now() / 1000) timestamp: Math.floor(Date.now() / 1000)
}; };
// console.log('创建take_out消息对象:', takeOutMsg);
alerts.push(takeOutMsg); alerts.push(takeOutMsg);
renderMessages(); // console.log('当前alerts数组长度:', alerts.length);
addLog(`人员带出: ${takeOutMsg.person_name} (历史告警: ${takeOutMsg.historical_alert_count})`, 'warning'); renderMessages();
} // console.log('渲染消息列表完成');
addLog(`人员带出: ${takeOutMsg.person_name} (第${takeOutMsg.historical_alert_count}次)`, 'warning');
} else {
// console.log('未知的消息类型:', msg.msg_type);
} }
} catch (e) { } catch (e) {
console.error('invalid ws message', e); console.error('解析WebSocket消息错误:', e);
console.error('原始消息数据:', event.data);
} }
}; };
} }