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
+6 -1
View File
@@ -1,6 +1,6 @@
-- name: CreateChatRoute :one
INSERT INTO bot_channel_routes (
bot_id, channel_type, channel_config_id, external_conversation_id, external_thread_id, default_reply_target, metadata
bot_id, channel_type, channel_config_id, external_conversation_id, external_thread_id, conversation_type, default_reply_target, metadata
)
VALUES (
sqlc.arg(bot_id),
@@ -8,6 +8,7 @@ VALUES (
sqlc.narg(channel_config_id)::uuid,
sqlc.arg(conversation_id),
sqlc.narg(thread_id)::text,
sqlc.narg(conversation_type)::text,
sqlc.narg(reply_target)::text,
sqlc.arg(metadata)
)
@@ -19,6 +20,7 @@ RETURNING
channel_config_id,
external_conversation_id AS conversation_id,
external_thread_id AS thread_id,
conversation_type,
default_reply_target AS reply_target,
metadata,
created_at,
@@ -33,6 +35,7 @@ SELECT
channel_config_id,
external_conversation_id AS conversation_id,
external_thread_id AS thread_id,
conversation_type,
default_reply_target AS reply_target,
metadata,
created_at,
@@ -53,6 +56,7 @@ SELECT
channel_config_id,
external_conversation_id AS conversation_id,
external_thread_id AS thread_id,
conversation_type,
default_reply_target AS reply_target,
metadata,
created_at,
@@ -69,6 +73,7 @@ SELECT
channel_config_id,
external_conversation_id AS conversation_id,
external_thread_id AS thread_id,
conversation_type,
default_reply_target AS reply_target,
metadata,
created_at,