diff --git a/demo/agent/mock_sync.py b/demo/agent/mock_sync.py index 74d871a..d95880c 100644 --- a/demo/agent/mock_sync.py +++ b/demo/agent/mock_sync.py @@ -815,8 +815,12 @@ def sync_to_central(pg, sp_id: int, contacts_data, run_counter: int = 1): for j, (sender_role, msg_type, content) in enumerate(messages): local_id_counter += 1 - # 时间递增:每条消息间隔 2~30 分钟 - msg_time = base_time + time_offset + dt.timedelta(minutes=j * random.randint(2, 30)) + # 时间递增:每条消息在前一条基础上累加 2~30 分钟,确保单调递增 + if j == 0: + cumulative_minutes = 0 + else: + cumulative_minutes += random.randint(2, 30) + msg_time = base_time + time_offset + dt.timedelta(minutes=cumulative_minutes) if sender_role == "customer": sender_wx = wx_username if not is_group else f"wxid_customer_{j}"