mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
de62f94315
When input tokens exceed a configurable threshold after a conversation round, the system asynchronously compacts older messages into a summary. Cascading compactions reference prior summaries via <prior_context> tags to maintain conversational continuity without duplicating content. - Add bot_history_message_compacts table and compact_id on messages - Add compaction_enabled, compaction_threshold, compaction_model_id to bots - Implement compaction service (internal/compaction) with LLM summarization - Integrate into conversation flow: replace compacted messages with summaries wrapped in <summary> tags during context loading - Add REST API endpoints (GET/DELETE /bots/:bot_id/compaction/logs) - Add frontend Compaction tab with settings and log viewer - Wire compaction service into both dev (cmd/agent) and prod (cmd/memoh) entry points - Update test mocks to include new GetBotByID columns
13 lines
467 B
SQL
13 lines
467 B
SQL
-- 0040_compaction (down)
|
|
-- Revert context compaction support.
|
|
|
|
ALTER TABLE bots DROP COLUMN IF EXISTS compaction_model_id;
|
|
ALTER TABLE bots DROP COLUMN IF EXISTS compaction_threshold;
|
|
ALTER TABLE bots DROP COLUMN IF EXISTS compaction_enabled;
|
|
|
|
DROP INDEX IF EXISTS idx_bot_history_messages_compact;
|
|
ALTER TABLE bot_history_messages DROP COLUMN IF EXISTS compact_id;
|
|
|
|
DROP INDEX IF EXISTS idx_compacts_bot_session;
|
|
DROP TABLE IF EXISTS bot_history_message_compacts;
|