Files
Memoh/db/queries/history.sql
T
BBQ 5a35ef34ac 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>
2026-02-06 14:41:54 +08:00

32 lines
914 B
SQL

-- name: CreateHistory :one
INSERT INTO history (bot_id, session_id, messages, metadata, skills, timestamp)
VALUES ($1, $2, $3, $4, $5, $6)
RETURNING id, bot_id, session_id, messages, metadata, skills, timestamp;
-- name: ListHistoryByBotSessionSince :many
SELECT id, bot_id, session_id, messages, metadata, skills, timestamp
FROM history
WHERE bot_id = $1 AND session_id = $2 AND timestamp >= $3
ORDER BY timestamp ASC;
-- name: GetHistoryByID :one
SELECT id, bot_id, session_id, messages, metadata, skills, timestamp
FROM history
WHERE id = $1;
-- name: ListHistoryByBotSession :many
SELECT id, bot_id, session_id, messages, metadata, skills, timestamp
FROM history
WHERE bot_id = $1 AND session_id = $2
ORDER BY timestamp DESC
LIMIT $3;
-- name: DeleteHistoryByID :exec
DELETE FROM history
WHERE id = $1;
-- name: DeleteHistoryByBotSession :exec
DELETE FROM history
WHERE bot_id = $1 AND session_id = $2;