Skip to content

Project NOMAD is an offline-first knowledge and education server. Wikipedia, thousands of books, courses, maps, and optional local AI, all running on hardware you own with no internet required.

TypeScript

fix(AI): add truncation DEBUG log

Jake Turnere3b758f11ed5
diff --git a/admin/app/services/ollama_service.ts b/admin/app/services/ollama_service.ts
index d5a4d7e8..075fda41 100644
--- a/admin/app/services/ollama_service.ts
+++ b/admin/app/services/ollama_service.ts
@@ -500,6 +500,18 @@ export class OllamaService {
? s.slice(0, OllamaService.EMBED_MAX_INPUT_CHARS)
: s
)
+ const truncatedCount = input.reduce(
+ (n, s) => (s.length > OllamaService.EMBED_MAX_INPUT_CHARS ? n + 1 : n),
+ 0
+ )
+ if (truncatedCount > 0) {
+ logger.debug(
+ '[OllamaService] embed: pre-capped %d/%d inputs at %d chars',
+ truncatedCount,
+ input.length,
+ OllamaService.EMBED_MAX_INPUT_CHARS
+ )
+ }
try {
// Prefer Ollama native endpoint (supports batch input natively).