mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-15 22:15:00 +00:00
- Add channel_pending_messages table with UUID v7 PK, sender_id tracking - Implement PendingMessageStore interface with batched flush (3s/20 msgs) - Add LLM-based auto-compaction when entries exceed threshold (50) - Wire persistent history into all channel factories (Telegram, Discord, Slack, Feishu, Zalo) - Extract channel type constants (TypeTelegram, TypeDiscord, etc.) to eliminate magic strings - Add HTTP API endpoints for pending messages management (list, view, compact, clear) - Add Pending Messages dashboard page with group titles resolved from session metadata - Track sender_id across entire pipeline (migration → store → history → handlers)
20 lines
891 B
SQL
20 lines
891 B
SQL
-- Channel pending messages: persists group chat messages when bot is NOT mentioned.
|
|
-- Used to provide conversational context when bot IS mentioned.
|
|
-- Supports LLM-based compaction (is_summary rows) and 7-day TTL cleanup.
|
|
|
|
CREATE TABLE channel_pending_messages (
|
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v7(),
|
|
channel_name VARCHAR(100) NOT NULL,
|
|
history_key VARCHAR(200) NOT NULL,
|
|
sender VARCHAR(255) NOT NULL,
|
|
sender_id VARCHAR(255) NOT NULL DEFAULT '',
|
|
body TEXT NOT NULL,
|
|
platform_msg_id VARCHAR(100) NOT NULL DEFAULT '',
|
|
is_summary BOOLEAN NOT NULL DEFAULT false,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX idx_channel_pending_messages_lookup
|
|
ON channel_pending_messages (channel_name, history_key, created_at);
|