import React, { useEffect, useState } from "react"; import System from "@/models/system"; import { OLLAMA_COMMON_URLS } from "@/utils/constants"; import { CaretDown, CaretUp, Info, CircleNotch } from "@phosphor-icons/react"; import useProviderEndpointAutoDiscovery from "@/hooks/useProviderEndpointAutoDiscovery"; import { Tooltip } from "react-tooltip"; import { Link } from "react-router-dom"; export default function OllamaLLMOptions({ settings }) { const { autoDetecting: loading, basePath, basePathValue, authToken, authTokenValue, showAdvancedControls, setShowAdvancedControls, handleAutoDetectClick, } = useProviderEndpointAutoDiscovery({ provider: "ollama", initialBasePath: settings?.OllamaLLMBasePath, ENDPOINTS: OLLAMA_COMMON_URLS, }); const [maxTokens, setMaxTokens] = useState( settings?.OllamaLLMTokenLimit || "" ); return (
Choose how long Ollama should keep your model in memory before unloading.{" "} Learn more →
Specify the maximum number of tokens that can be used for
the model context window.
If you leave this field blank, the context window limit will
be auto-detected from the model and applied to all chats. If
auto-detection fails, a fallback context window limit of
4096 will be used.
Important: Some models have very large context
windows using the full context window limit can dramatically
increase the memory usage of your system. For this reason,
we will automatically cap the context window limit to 16,384
tokens if the model supports more than that and no value is
specified.
If an invalid value is entered, AnythingLLM will handle this
for you so that chats do not fail.
Enter a Bearer Auth Token for interacting with
your Ollama server.
Used only if running Ollama behind an authentication
server.
Select the Ollama model you want to use. Models will load after entering a valid Ollama URL.
Choose the Ollama model you want to use for your conversations.