From 8e7d11a162bf50c98edc8a5eba3184e2b98f33d8 Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 19 Jun 2026 17:50:56 +0800 Subject: [PATCH] =?UTF-8?q?feat(llm):=20=E5=A4=84=E7=90=86=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E7=9A=84=E6=B6=88=E6=81=AF=E8=87=AA=E5=8A=A8=E8=BD=AF?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=B9=B6=E9=9A=90=E8=97=8F=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - MarkAsProcessed 在写入 reply/processed_at 的同时设置 deleted_at, 避免 /admin/llm 队列页堆积已处理消息(仍可勾选"包含已删除"查看) - 前端列表中已删除的消息行隐藏删除按钮,改为显示灰色"已删除"标签 Co-Authored-By: Claude --- internal/autoreply/queue.go | 8 +++++--- meshmap_frontend/src/components/AdminLLM.vue | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/internal/autoreply/queue.go b/internal/autoreply/queue.go index 60dae1f..6f77aa6 100644 --- a/internal/autoreply/queue.go +++ b/internal/autoreply/queue.go @@ -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 } diff --git a/meshmap_frontend/src/components/AdminLLM.vue b/meshmap_frontend/src/components/AdminLLM.vue index af88f07..a6e479f 100644 --- a/meshmap_frontend/src/components/AdminLLM.vue +++ b/meshmap_frontend/src/components/AdminLLM.vue @@ -298,9 +298,14 @@ onMounted(() => { {{ formatTime(msg.received_at) }} {{ formatTime(msg.processed_at) }} - + 已删除 @@ -678,6 +683,15 @@ onMounted(() => { border: 1px solid transparent; } +.muted-tag { + display: inline-block; + padding: 0.25rem 0.6rem; + border-radius: 6px; + font-size: 0.75rem; + color: #94a3b8; + background: #f1f5f9; +} + .status-badge[style*='#fff3cd'] { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important; color: #92400e;