feat: max context tokens

This commit is contained in:
Acbox
2026-02-18 17:20:22 +08:00
parent 46e8a48ab8
commit 77e9f585a1
26 changed files with 277 additions and 51 deletions
+5 -1
View File
@@ -2,6 +2,7 @@
SELECT
bots.id AS bot_id,
bots.max_context_load_time,
bots.max_context_tokens,
bots.language,
bots.allow_guest,
chat_models.model_id AS chat_model_id,
@@ -19,6 +20,7 @@ WHERE bots.id = $1;
WITH updated AS (
UPDATE bots
SET max_context_load_time = sqlc.arg(max_context_load_time),
max_context_tokens = sqlc.arg(max_context_tokens),
language = sqlc.arg(language),
allow_guest = sqlc.arg(allow_guest),
chat_model_id = COALESCE(sqlc.narg(chat_model_id)::uuid, bots.chat_model_id),
@@ -27,11 +29,12 @@ WITH updated AS (
search_provider_id = COALESCE(sqlc.narg(search_provider_id)::uuid, bots.search_provider_id),
updated_at = now()
WHERE bots.id = sqlc.arg(id)
RETURNING bots.id, bots.max_context_load_time, bots.language, bots.allow_guest, bots.chat_model_id, bots.memory_model_id, bots.embedding_model_id, bots.search_provider_id
RETURNING bots.id, bots.max_context_load_time, bots.max_context_tokens, bots.language, bots.allow_guest, bots.chat_model_id, bots.memory_model_id, bots.embedding_model_id, bots.search_provider_id
)
SELECT
updated.id AS bot_id,
updated.max_context_load_time,
updated.max_context_tokens,
updated.language,
updated.allow_guest,
chat_models.model_id AS chat_model_id,
@@ -47,6 +50,7 @@ LEFT JOIN search_providers ON search_providers.id = updated.search_provider_id;
-- name: DeleteSettingsByBotID :exec
UPDATE bots
SET max_context_load_time = 1440,
max_context_tokens = 0,
language = 'auto',
allow_guest = false,
chat_model_id = NULL,