project-nomad/admin/app/controllers
Henry Estela 8b54310746
Improve context window size estimation
fixes issue seen with some models in lm studio resulting in:
"The number of tokens to keep from the initial prompt is greater than the context length (n_keep: 4705>= n_ctx: 4096)"

Fixed char/token estimate, the old value was too optimistic,
causing the cap to allow more text than the budget allowed in actual tokens.
After RAG injection, estimates the system prompt token count.
If it exceeds ~3000 tokens, requests the next standard context size (8192, 16384, 32768, or 65536),
large enough to fit the prompt plus a 2048-token buffer for the conversation and response.

For Ollama, num_ctx is honoured per-request and will load the model with that context
window. For LM Studio, the parameter is silently ignored — but the tighter char
estimate will also reduce how much RAG text gets stuffed in, so it's less likely to
overflow.
2026-03-25 17:18:06 -07:00
..
benchmark_controller.ts fix(Benchmark): improved error reporting and fix sysbench race condition 2026-02-11 22:09:31 -08:00
chats_controller.ts fix: improve type-safety for KVStore values 2026-03-03 20:51:38 -08:00
collection_updates_controller.ts fix(security): path traversal and SSRF protections from pre-launch audit 2026-03-11 14:08:09 -07:00
docs_controller.ts fix(Docs): fix doc rendering 2025-07-11 15:31:07 -07:00
downloads_controller.ts fix(downloads): allow users to dismiss failed downloads 2026-03-20 11:46:10 -07:00
easy_setup_controller.ts feat: curated content system overhaul 2026-02-11 15:44:46 -08:00
home_controller.ts fix(OSM): osm installation 2025-08-20 23:05:19 -07:00
maps_controller.ts fix(maps): respect request protocol for reverse proxy HTTPS support 2026-03-20 11:46:10 -07:00
ollama_controller.ts Improve context window size estimation 2026-03-25 17:18:06 -07:00
rag_controller.ts fix(ai-chat): ingestion of documents with openai and add cleanup button 2026-03-25 17:18:05 -07:00
settings_controller.ts fix(ai-chat): clearing ollama url results in a 500 error 2026-03-25 17:18:04 -07:00
system_controller.ts fix: surface actual error message when service installation fails 2026-03-25 16:30:35 -07:00
zim_controller.ts fix(security): path traversal and SSRF protections from pre-launch audit 2026-03-11 14:08:09 -07:00