feat(channel): pass conversation type through to agent gateway and persist in route

Propagate conversation type (direct/group/thread) from channel adapters
all the way to the agent prompt. Store conversation_type on bot_channel_routes
so the bot knows whether a message originates from a p2p chat, group, or thread.

Schema changes are folded into the 0001 init migration (destructive update).
This commit is contained in:
BBQ
2026-02-13 05:10:35 +08:00
parent 0406f42e86
commit faaadf14c5
18 changed files with 173 additions and 153 deletions
+1
View File
@@ -207,6 +207,7 @@ CREATE TABLE IF NOT EXISTS bot_channel_routes (
channel_config_id UUID REFERENCES bot_channel_configs(id) ON DELETE SET NULL,
external_conversation_id TEXT NOT NULL,
external_thread_id TEXT,
conversation_type TEXT,
default_reply_target TEXT,
metadata JSONB NOT NULL DEFAULT '{}'::jsonb,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
@@ -0,0 +1,2 @@
-- 0002_channel_identity_avatar (down)
ALTER TABLE channel_identities DROP COLUMN IF EXISTS avatar_url;
@@ -0,0 +1,3 @@
-- 0002_channel_identity_avatar
-- Add avatar_url column to channel_identities for sender profile display.
ALTER TABLE channel_identities ADD COLUMN IF NOT EXISTS avatar_url TEXT;
@@ -0,0 +1,2 @@
-- 0003_route_conversation_type (down)
ALTER TABLE bot_channel_routes DROP COLUMN IF EXISTS conversation_type;
@@ -0,0 +1,3 @@
-- 0003_route_conversation_type
-- Add conversation_type column to bot_channel_routes for conversation context.
ALTER TABLE bot_channel_routes ADD COLUMN IF NOT EXISTS conversation_type TEXT;