debug: purchase 分支和 POST 入口加 attachments 日志

- POST /api/rooms/:roomId/messages 入口打印收到的 attachments
- handleAIResult purchase 分支开头打印 attachments 值
- 用于定位附件关联失败的具体环节
This commit is contained in:
2026-07-22 16:04:41 +08:00
parent 742bb908a5
commit fb07144ef3

View File

@@ -163,6 +163,7 @@ app.get('/api/rooms/:roomId/messages', auth, (req, res) => {
app.post('/api/rooms/:roomId/messages', auth, async (req, res) => { app.post('/api/rooms/:roomId/messages', auth, async (req, res) => {
const { text, attachments } = req.body; const { text, attachments } = req.body;
console.log('📨 收到消息, text:', (text||'').substring(0,30), 'attachments:', JSON.stringify(attachments));
const roomId = req.params.roomId; const roomId = req.params.roomId;
const username = req.user.username; const username = req.user.username;
const now = timestamp(); const now = timestamp();
@@ -439,6 +440,7 @@ function handleAIResult(aiResult, roomId, username, originalText, attachments) {
return; return;
} }
if (aiResult.action === 'purchase') { if (aiResult.action === 'purchase') {
console.log('🛒 purchase 分支, attachments:', JSON.stringify(attachments));
// 引用最近图片:用户要求把之前的图片关联到某采购 // 引用最近图片:用户要求把之前的图片关联到某采购
let usedRecentImage = false; let usedRecentImage = false;
if (aiResult.use_recent_image) { if (aiResult.use_recent_image) {