fix issues

This commit is contained in:
2026-07-29 08:18:11 +08:00
parent 074e907cae
commit b6f2c8dd42

View File

@@ -51,9 +51,9 @@ router.post('/:roomId/messages', authMiddleware, async (req, res) => {
} catch (e) { } catch (e) {
console.error('AI 分析失败:', e.message); console.error('AI 分析失败:', e.message);
var errText = '❌ ' + (e.message || 'AI 处理失败,请稍后重试'); var errText = '❌ ' + (e.message || 'AI 处理失败,请稍后重试');
var result = db.prepare('INSERT INTO messages (room_id, user, text, timestamp) VALUES (?,?,?,?)').run(roomId, '小财', errText, timestamp()); var errResult = db.prepare('INSERT INTO messages (room_id, user, text, timestamp) VALUES (?,?,?,?)').run(roomId, '小财', errText, timestamp());
var msg = { id: result.lastInsertRowid, room_id: roomId, user: '小财', text: errText, attachments: [], timestamp: timestamp() }; var errMsg = { id: errResult.lastInsertRowid, room_id: roomId, user: '小财', text: errText, attachments: [], timestamp: timestamp() };
broadcastToRoom(roomId, { type: 'new_message', message: msg }); broadcastToRoom(roomId, { type: 'new_message', message: errMsg });
} }
}); });