anhkhoiphan commited on
Commit
2bb7a3b
·
1 Parent(s): ed21910

Sửa lần 6 để gửi được ảnh và pdf

Browse files
src/components/ChatArea.jsx CHANGED
@@ -1035,13 +1035,10 @@ function ChatArea({
1035
  }
1036
 
1037
  // Send via WebSocket (with real URL if upload succeeded)
 
1038
  console.log("[ChatArea] sendMessage:", { roomId: room, content: contentTrimmed, tempId: msgTempId, hasAttachment: !!attachment });
1039
  socketService.sendMessage({ roomId: room, content: contentTrimmed, tempId: msgTempId, attachment });
1040
 
1041
- if (files?.length > 0 && /@StudyBot/i.test(contentTrimmed)) {
1042
- callStudyBotWithFile(contentTrimmed, files[0], null);
1043
- }
1044
-
1045
  // Stop typing
1046
  socketService.emitStopTyping(room);
1047
  if (typingTimeoutRef.current) {
 
1035
  }
1036
 
1037
  // Send via WebSocket (with real URL if upload succeeded)
1038
+ // Backend will detect @StudyBot mention and call agent with the file URL automatically
1039
  console.log("[ChatArea] sendMessage:", { roomId: room, content: contentTrimmed, tempId: msgTempId, hasAttachment: !!attachment });
1040
  socketService.sendMessage({ roomId: room, content: contentTrimmed, tempId: msgTempId, attachment });
1041
 
 
 
 
 
1042
  // Stop typing
1043
  socketService.emitStopTyping(room);
1044
  if (typingTimeoutRef.current) {
src/store/slices/messageSlice.js CHANGED
@@ -19,6 +19,7 @@ function normalizeRoomMessage(msg) {
19
  created_at: msg.created_at,
20
  is_pinned: msg.is_pinned || false,
21
  reply_to_id: msg.reply_to_id || null,
 
22
  };
23
  }
24
 
 
19
  created_at: msg.created_at,
20
  is_pinned: msg.is_pinned || false,
21
  reply_to_id: msg.reply_to_id || null,
22
+ attachments: msg.attachments || [],
23
  };
24
  }
25