Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Warn about small context windows on self-hosted AI providers (#7776)

Anthony Stirlingd43a3dfe90e4
diff --git a/frontend/editor/public/locales/en-US/translation.toml b/frontend/editor/public/locales/en-US/translation.toml
index a8abf6ce3b..e3cf94b56a 100644
--- a/frontend/editor/public/locales/en-US/translation.toml
+++ b/frontend/editor/public/locales/en-US/translation.toml
@@ -818,6 +818,7 @@ openai = "OpenAI API key"
setPlaceholder = "Saved - leave blank to keep the current key"
[admin.settings.ai.models.baseUrl]
+contextWindow = "Use a context window of at least 16,384 tokens. Smaller windows silently drop part of the prompt. Ollama defaults to 4,096 - raise OLLAMA_CONTEXT_LENGTH."
description = "Base URL of the OpenAI-compatible / Ollama endpoint, e.g. http://ollama:11434/v1."
label = "Provider base URL"
warning = "The base URL must point at a trusted internal endpoint. The engine will make server-side requests to it, so an untrusted value is SSRF-sensitive."
diff --git a/frontend/editor/src/proprietary/components/shared/config/configSections/AdminAiModelsSection.tsx b/frontend/editor/src/proprietary/components/shared/config/configSections/AdminAiModelsSection.tsx
index acba1c9571..8a5621fec3 100644
--- a/frontend/editor/src/proprietary/components/shared/config/configSections/AdminAiModelsSection.tsx
+++ b/frontend/editor/src/proprietary/components/shared/config/configSections/AdminAiModelsSection.tsx
@@ -370,6 +370,23 @@ export default function AdminAiModelsSection() {
</Text>
</Alert>
)}
+
+ {showBaseUrl && (
+ <Alert
+ variant="light"
+ color="blue"
+ icon={
+ <LocalIcon icon="info-rounded" width="1rem" height="1rem" />
+ }
+ >
+ <Text size="xs">
+ {t(
+ "admin.settings.ai.models.baseUrl.contextWindow",
+ "Use a context window of at least 16,384 tokens. Smaller windows silently drop part of the prompt. Ollama defaults to 4,096 - raise OLLAMA_CONTEXT_LENGTH.",
+ )}
+ </Text>
+ </Alert>
+ )}
</Stack>
</Paper>
</Stack>