feat(llm): 处理完成的消息自动软删除并隐藏删除按钮
- MarkAsProcessed 在写入 reply/processed_at 的同时设置 deleted_at, 避免 /admin/llm 队列页堆积已处理消息(仍可勾选"包含已删除"查看) - 前端列表中已删除的消息行隐藏删除按钮,改为显示灰色"已删除"标签 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -92,13 +92,15 @@ func (q *DBMessageQueue) MarkAsProcessing(id uint64) error {
|
||||
return q.db.Model(&llmMessageQueueRecord{}).Where("id = ?", id).Update("status", statusProcessing).Error
|
||||
}
|
||||
|
||||
// MarkAsProcessed marks a message as successfully processed
|
||||
// MarkAsProcessed marks a message as successfully processed and soft-deletes it
|
||||
// 处理完成的消息直接软删除,避免队列页堆积;保留 reply/processed_at 便于查询历史
|
||||
func (q *DBMessageQueue) MarkAsProcessed(id uint64, reply string) error {
|
||||
now := time.Now()
|
||||
return q.db.Model(&llmMessageQueueRecord{}).Where("id = ?", id).Updates(map[string]any{
|
||||
"status": statusProcessed,
|
||||
"reply": reply,
|
||||
"status": statusProcessed,
|
||||
"reply": reply,
|
||||
"processed_at": &now,
|
||||
"deleted_at": &now,
|
||||
}).Error
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user