mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
5a35ef34ac
- 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>
32 lines
914 B
SQL
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;
|
|
|