feat(bot): replace maxTokens with contextMessages option

- Switched `maxTokens` to `contextMessages` to set chat history length instead of token limit.
- Updated environment variables, NixOS module, and prompt building logic for consistency.
- Removed in-memory conversation history, now fetching from Nextcloud for better scalability.
This commit is contained in:
Harald Hoyer 2026-02-03 17:00:50 +01:00
parent 538d7623be
commit b35373b0ec
4 changed files with 122 additions and 109 deletions

View file

@ -56,12 +56,12 @@ in {
description = "Nextcloud usernames allowed to talk to the bot (empty = all)";
};
maxTokens = mkOption {
contextMessages = mkOption {
type = types.int;
default = 4096;
description = "Max tokens for Claude response";
default = 6;
description = "Number of recent messages to fetch from chat for context";
};
timeout = mkOption {
type = types.int;
default = 120;
@ -89,7 +89,7 @@ in {
NEXTCLOUD_URL = cfg.nextcloudUrl;
CLAUDE_PATH = cfg.claudePath;
ALLOWED_USERS = concatStringsSep "," cfg.allowedUsers;
MAX_TOKENS = toString cfg.maxTokens;
CONTEXT_MESSAGES = toString cfg.contextMessages;
TIMEOUT = toString cfg.timeout;
SYSTEM_PROMPT = cfg.systemPrompt or "";
PYTHONPATH = botModule;