修复聊天消息不显示最新数据:所有列表查询排序从 created_at DESC 改为 id DESC,记录创建函数显式设置 CreatedAt,后端 v1.2.1 / 前端 v0.3.1

This commit is contained in:
2026-08-07 22:21:26 +08:00
parent b6fabf59b7
commit 92e766dfa8
11 changed files with 19 additions and 12 deletions
+2 -1
View File
@@ -369,6 +369,7 @@ func (s *Store) EnqueueLLMMessage(input LLMMessageQueueInput) (*LLMMessageQueueR
Status: LLMMessageStatusPending,
ReceivedAt: now,
ContentJSON: input.ContentJSON,
CreatedAt: now,
}
if err := s.db.Create(record).Error; err != nil {
@@ -396,7 +397,7 @@ func (s *Store) ListLLMMessages(opts ListOptions, botID uint64, includeDeleted b
}
// 排序和分页
query = query.Order("created_at DESC")
query = query.Order("id DESC")
if opts.Limit > 0 {
query = query.Limit(opts.Limit)
}