feat: add platform metadata in contacts

This commit is contained in:
Acbox
2026-02-20 22:19:15 +08:00
parent c9d96d9da3
commit 1a78ba3f53
8 changed files with 133 additions and 4 deletions
+16
View File
@@ -296,6 +296,22 @@ func (q *Queries) ListChatRoutes(ctx context.Context, chatID pgtype.UUID) ([]Lis
return items, nil
}
const updateChatRouteMetadata = `-- name: UpdateChatRouteMetadata :exec
UPDATE bot_channel_routes
SET metadata = $1, updated_at = now()
WHERE id = $2
`
type UpdateChatRouteMetadataParams struct {
Metadata []byte `json:"metadata"`
ID pgtype.UUID `json:"id"`
}
func (q *Queries) UpdateChatRouteMetadata(ctx context.Context, arg UpdateChatRouteMetadataParams) error {
_, err := q.db.Exec(ctx, updateChatRouteMetadata, arg.Metadata, arg.ID)
return err
}
const updateChatRouteReplyTarget = `-- name: UpdateChatRouteReplyTarget :exec
UPDATE bot_channel_routes
SET default_reply_target = $1, updated_at = now()
+4 -4
View File
@@ -133,7 +133,7 @@ SELECT
m.bot_id,
m.route_id,
m.sender_channel_identity_id,
COALESCE(ci.user_id, m.sender_account_user_id) AS sender_user_id,
m.sender_account_user_id AS sender_user_id,
m.channel_type AS platform,
m.source_message_id AS external_message_id,
m.source_reply_to_message_id,
@@ -211,7 +211,7 @@ SELECT
m.bot_id,
m.route_id,
m.sender_channel_identity_id,
COALESCE(ci.user_id, m.sender_account_user_id) AS sender_user_id,
m.sender_account_user_id AS sender_user_id,
m.channel_type AS platform,
m.source_message_id AS external_message_id,
m.source_reply_to_message_id,
@@ -296,7 +296,7 @@ SELECT
m.bot_id,
m.route_id,
m.sender_channel_identity_id,
COALESCE(ci.user_id, m.sender_account_user_id) AS sender_user_id,
m.sender_account_user_id AS sender_user_id,
m.channel_type AS platform,
m.source_message_id AS external_message_id,
m.source_reply_to_message_id,
@@ -379,7 +379,7 @@ SELECT
m.bot_id,
m.route_id,
m.sender_channel_identity_id,
COALESCE(ci.user_id, m.sender_account_user_id) AS sender_user_id,
m.sender_account_user_id AS sender_user_id,
m.channel_type AS platform,
m.source_message_id AS external_message_id,
m.source_reply_to_message_id,
+17
View File
@@ -186,6 +186,23 @@ type McpConnection struct {
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type MediaAsset struct {
ID pgtype.UUID `json:"id"`
BotID pgtype.UUID `json:"bot_id"`
StorageProviderID pgtype.UUID `json:"storage_provider_id"`
ContentHash string `json:"content_hash"`
MediaType string `json:"media_type"`
Mime string `json:"mime"`
SizeBytes int64 `json:"size_bytes"`
StorageKey string `json:"storage_key"`
OriginalName pgtype.Text `json:"original_name"`
Width pgtype.Int4 `json:"width"`
Height pgtype.Int4 `json:"height"`
DurationMs pgtype.Int8 `json:"duration_ms"`
Metadata []byte `json:"metadata"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type Model struct {
ID pgtype.UUID `json:"id"`
ModelID string `json:"model_id"`