@@ -432,12 +432,20 @@ func (c *Conversation) pullMessageIntoTable(ctx context.Context, pullMsgData map
432
432
if err != nil {
433
433
log .ZWarn (ctx , "Failed to get messages by ClientMsgIDs" , err )
434
434
}
435
+ processedMsgIDs := make (map [string ]* model_struct.LocalChatLog , len (msgs .Msgs ))
435
436
localMessagesMap := datautil .SliceToMap (localMessages , func (msg * model_struct.LocalChatLog ) string { return msg .ClientMsgID })
436
437
for _ , v := range msgs .Msgs {
437
438
log .ZDebug (ctx , "msg detail" , "msg" , v , "conversationID" , conversationID )
438
439
//When the message has been marked and deleted by the cloud, it is directly inserted locally
439
440
//without any conversation and message update.
440
441
msg := MsgDataToLocalChatLog (v )
442
+ if existingMessage , ok := processedMsgIDs [v .ClientMsgID ]; ok {
443
+ c .handleExceptionMessages (ctx , existingMessage , msg )
444
+ v .Status = msg .Status
445
+ exceptionMsg = append (exceptionMsg , msg )
446
+ insertMessage = append (insertMessage , msg )
447
+ continue
448
+ }
441
449
if v .Status == constant .MsgStatusHasDeleted {
442
450
c .handleExceptionMessages (ctx , nil , msg )
443
451
v .ClientMsgID = msg .ClientMsgID
@@ -480,7 +488,7 @@ func (c *Conversation) pullMessageIntoTable(ctx context.Context, pullMsgData map
480
488
insertMessage = append (insertMessage , msg )
481
489
}
482
490
}
483
-
491
+ processedMsgIDs [ msg . ClientMsgID ] = msg
484
492
}
485
493
timeNow := time .Now ()
486
494
insertMsg [conversationID ] = append (insertMessage , c .faceURLAndNicknameHandle (ctx , selfInsertMessage , othersInsertMessage , conversationID )... )
0 commit comments