修复聊天消息不显示最新数据:所有列表查询排序从 created_at DESC 改为 id DESC,记录创建函数显式设置 CreatedAt,后端 v1.2.1 / 前端 v0.3.1
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user