fix: make query parameter of tool search_inbox optional

This commit is contained in:
Acbox
2026-03-04 22:26:24 +08:00
parent 54f42074ef
commit 674e8c6ce9
4 changed files with 4 additions and 7 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ WHERE bot_id = sqlc.arg(bot_id)
-- name: SearchInboxItems :many
SELECT * FROM bot_inbox
WHERE bot_id = sqlc.arg(bot_id)
AND content ILIKE '%' || sqlc.arg(query) || '%'
AND (sqlc.narg(query)::text IS NULL OR content ILIKE '%' || sqlc.narg(query)::text || '%')
AND (sqlc.narg(start_time)::timestamptz IS NULL OR created_at >= sqlc.narg(start_time)::timestamptz)
AND (sqlc.narg(end_time)::timestamptz IS NULL OR created_at <= sqlc.narg(end_time)::timestamptz)
AND (sqlc.narg(include_read)::boolean IS NULL OR sqlc.narg(include_read)::boolean = TRUE OR is_read = FALSE)