feat(channels): real LLM compaction for web UI compact endpoint

Extract CompactGroup() from runCompaction() for shared use by both
auto-compact and HTTP compact endpoint. Wire provider registry into
PendingMessagesHandler so /v1/pending-messages/compact performs actual
LLM summarization (keep 15 recent + summary) instead of hard delete.

Add rows-affected guard in Compact() to prevent duplicate summaries
when concurrent compactions race on the same key.
This commit is contained in:
viettranx committed 2026-03-10 00:29:48 +07:00
1 parent 30080f1acf
commit 4df60649e5
4 files changed
+121 -60

No files matched your search

+1 -1
View File
@@ -71,7 +71,7 @@ func wireHTTP(stores *store.Stores, token string, msgBus *bus.MessageBus, toolsR
}
if stores != nil && stores.PendingMessages != nil {
pendingMessagesH = httpapi.NewPendingMessagesHandler(stores.PendingMessages, token)
pendingMessagesH = httpapi.NewPendingMessagesHandler(stores.PendingMessages, token, providerReg)
}
return agentsH, skillsH, tracesH, mcpH, customToolsH, channelInstancesH, providersH, delegationsH, builtinToolsH, pendingMessagesH