feat: channel gateway implementation and multi-bot refactor

- Refactor channel manager with support for Sender/Receiver interfaces and hot-swappable adapters.
- Implement identity routing and pre-authentication logic for inbound messages.
- Update database schema to support bot pre-auth keys and extended channel session metadata.
- Add Telegram and Feishu channel configuration and adapter enhancements.
- Update Swagger documentation and internal handlers for channel management.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
BBQ
2026-02-06 14:41:54 +08:00
parent 0bba6d2913
commit 5a35ef34ac
106 changed files with 7910 additions and 3044 deletions
+26
View File
@@ -11,6 +11,32 @@ import (
"github.com/jackc/pgx/v5/pgtype"
)
const getContainerByBotID = `-- name: GetContainerByBotID :one
SELECT id, bot_id, container_id, container_name, image, status, namespace, auto_start, host_path, container_path, created_at, updated_at, last_started_at, last_stopped_at FROM containers WHERE bot_id = $1 ORDER BY updated_at DESC LIMIT 1
`
func (q *Queries) GetContainerByBotID(ctx context.Context, botID pgtype.UUID) (Container, error) {
row := q.db.QueryRow(ctx, getContainerByBotID, botID)
var i Container
err := row.Scan(
&i.ID,
&i.BotID,
&i.ContainerID,
&i.ContainerName,
&i.Image,
&i.Status,
&i.Namespace,
&i.AutoStart,
&i.HostPath,
&i.ContainerPath,
&i.CreatedAt,
&i.UpdatedAt,
&i.LastStartedAt,
&i.LastStoppedAt,
)
return i, err
}
const getContainerByContainerID = `-- name: GetContainerByContainerID :one
SELECT id, bot_id, container_id, container_name, image, status, namespace, auto_start, host_path, container_path, created_at, updated_at, last_started_at, last_stopped_at FROM containers WHERE container_id = $1
`