mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
refactor: replace Load More with Pagination across frontend and backend
- Replace all "Load More" / "Show More" buttons with Pagination components in model-list, bot-compaction, and bot-heartbeat views - Convert backend log APIs (compaction, heartbeat, schedule) from cursor-based (before+limit) to offset+limit pagination with total_count - Update SQL queries to use OFFSET+LIMIT and add COUNT queries - Add shared parseOffsetLimit helper in handler_helpers.go - Regenerate sqlc, Swagger docs, and TypeScript SDK - Clean up unused i18n keys (loadMore, showMore, history.loadMore)
This commit is contained in:
@@ -24,9 +24,11 @@ WHERE id = $1;
|
||||
SELECT id, bot_id, session_id, status, summary, message_count, error_message, usage, model_id, started_at, completed_at
|
||||
FROM bot_history_message_compacts
|
||||
WHERE bot_id = $1
|
||||
AND ($2::timestamptz IS NULL OR started_at < $2)
|
||||
ORDER BY started_at DESC
|
||||
LIMIT $3;
|
||||
LIMIT $2 OFFSET $3;
|
||||
|
||||
-- name: CountCompactionLogsByBot :one
|
||||
SELECT count(*) FROM bot_history_message_compacts WHERE bot_id = $1;
|
||||
|
||||
-- name: ListCompactionLogsBySession :many
|
||||
SELECT id, bot_id, session_id, status, summary, message_count, error_message, usage, model_id, started_at, completed_at
|
||||
|
||||
@@ -18,9 +18,11 @@ RETURNING id, bot_id, session_id, status, result_text, error_message, usage, mod
|
||||
SELECT id, bot_id, session_id, status, result_text, error_message, usage, started_at, completed_at
|
||||
FROM bot_heartbeat_logs
|
||||
WHERE bot_id = $1
|
||||
AND ($2::timestamptz IS NULL OR started_at < $2::timestamptz)
|
||||
ORDER BY started_at DESC
|
||||
LIMIT $3;
|
||||
LIMIT $2 OFFSET $3;
|
||||
|
||||
-- name: CountHeartbeatLogsByBot :one
|
||||
SELECT count(*) FROM bot_heartbeat_logs WHERE bot_id = $1;
|
||||
|
||||
-- name: DeleteHeartbeatLogsByBot :exec
|
||||
DELETE FROM bot_heartbeat_logs WHERE bot_id = $1;
|
||||
|
||||
@@ -18,17 +18,21 @@ RETURNING id, schedule_id, bot_id, session_id, status, result_text, error_messag
|
||||
SELECT id, schedule_id, bot_id, session_id, status, result_text, error_message, usage, started_at, completed_at
|
||||
FROM schedule_logs
|
||||
WHERE bot_id = $1
|
||||
AND ($2::timestamptz IS NULL OR started_at < $2::timestamptz)
|
||||
ORDER BY started_at DESC
|
||||
LIMIT $3;
|
||||
LIMIT $2 OFFSET $3;
|
||||
|
||||
-- name: CountScheduleLogsByBot :one
|
||||
SELECT count(*) FROM schedule_logs WHERE bot_id = $1;
|
||||
|
||||
-- name: ListScheduleLogsBySchedule :many
|
||||
SELECT id, schedule_id, bot_id, session_id, status, result_text, error_message, usage, started_at, completed_at
|
||||
FROM schedule_logs
|
||||
WHERE schedule_id = $1
|
||||
AND ($2::timestamptz IS NULL OR started_at < $2::timestamptz)
|
||||
ORDER BY started_at DESC
|
||||
LIMIT $3;
|
||||
LIMIT $2 OFFSET $3;
|
||||
|
||||
-- name: CountScheduleLogsBySchedule :one
|
||||
SELECT count(*) FROM schedule_logs WHERE schedule_id = $1;
|
||||
|
||||
-- name: DeleteScheduleLogsByBot :exec
|
||||
DELETE FROM schedule_logs WHERE bot_id = $1;
|
||||
|
||||
Reference in New Issue
Block a user