mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-22 19:30:15 +01:00
🪙 feat: Configure Max Context and Output Tokens (#2648)
* chore: make frequent 'error' log into 'debug' log * feat: add maxContextTokens as a conversation field * refactor(settings): increase popover height * feat: add DynamicInputNumber and maxContextTokens to all endpoints that support it (frontend), fix schema * feat: maxContextTokens handling (backend) * style: revert popover height * feat: max tokens * fix: Ollama Vision firebase compatibility * fix: Ollama Vision, use message_file_map to determine multimodal request * refactor: bring back MobileNav and improve title styling
This commit is contained in:
parent
5293b73b6d
commit
6ba7f60eec
26 changed files with 420 additions and 22 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import React from 'react';
|
||||
import TextareaAutosize from 'react-textarea-autosize';
|
||||
import type { TModelSelectProps } from '~/common';
|
||||
import { ESide } from '~/common';
|
||||
import {
|
||||
Input,
|
||||
Label,
|
||||
|
|
@ -12,9 +11,11 @@ import {
|
|||
SelectDropDown,
|
||||
HoverCardTrigger,
|
||||
} from '~/components/ui';
|
||||
import { cn, defaultTextProps, optionText, removeFocusOutlines } from '~/utils';
|
||||
import { DynamicInputNumber } from '~/components/SidePanel/Parameters';
|
||||
import OptionHover from './OptionHover';
|
||||
import { cn, defaultTextProps, optionText, removeFocusOutlines } from '~/utils/';
|
||||
import { useLocalize } from '~/hooks';
|
||||
import { ESide } from '~/common';
|
||||
|
||||
export default function Settings({ conversation, setOption, models, readonly }: TModelSelectProps) {
|
||||
const localize = useLocalize();
|
||||
|
|
@ -83,6 +84,28 @@ export default function Settings({ conversation, setOption, models, readonly }:
|
|||
</div>
|
||||
</div>
|
||||
<div className="col-span-5 flex flex-col items-center justify-start gap-6 px-3 sm:col-span-2">
|
||||
<DynamicInputNumber
|
||||
columnSpan={2}
|
||||
settingKey="maxContextTokens"
|
||||
setOption={setOption}
|
||||
label="com_endpoint_context_tokens"
|
||||
labelCode={true}
|
||||
description="com_endpoint_context_info"
|
||||
descriptionCode={true}
|
||||
placeholder="com_nav_theme_system"
|
||||
placeholderCode={true}
|
||||
descriptionSide="right"
|
||||
conversation={conversation}
|
||||
readonly={readonly}
|
||||
range={{
|
||||
min: 10,
|
||||
max: 2000000,
|
||||
step: 1000,
|
||||
}}
|
||||
className="mt-1 w-full justify-between"
|
||||
inputClassName="w-1/3"
|
||||
showDefault={false}
|
||||
/>
|
||||
<HoverCard openDelay={300}>
|
||||
<HoverCardTrigger className="grid w-full items-center gap-2">
|
||||
<div className="flex justify-between">
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@ import {
|
|||
SelectDropDown,
|
||||
HoverCardTrigger,
|
||||
} from '~/components/ui';
|
||||
import OptionHover from './OptionHover';
|
||||
import { cn, defaultTextProps, optionText, removeFocusOutlines } from '~/utils';
|
||||
import { DynamicInputNumber } from '~/components/SidePanel/Parameters';
|
||||
import OptionHover from './OptionHover';
|
||||
import { useLocalize } from '~/hooks';
|
||||
import { ESide } from '~/common';
|
||||
|
||||
|
|
@ -103,6 +104,28 @@ export default function Settings({ conversation, setOption, models, readonly }:
|
|||
</div>
|
||||
</div>
|
||||
<div className="col-span-5 flex flex-col items-center justify-start gap-6 px-3 sm:col-span-2">
|
||||
<DynamicInputNumber
|
||||
columnSpan={2}
|
||||
settingKey="maxContextTokens"
|
||||
setOption={setOption}
|
||||
label="com_endpoint_context_tokens"
|
||||
labelCode={true}
|
||||
description="com_endpoint_context_info"
|
||||
descriptionCode={true}
|
||||
placeholder="com_nav_theme_system"
|
||||
placeholderCode={true}
|
||||
descriptionSide="right"
|
||||
conversation={conversation}
|
||||
readonly={readonly}
|
||||
range={{
|
||||
min: 10,
|
||||
max: 2000000,
|
||||
step: 1000,
|
||||
}}
|
||||
className="mt-1 w-full justify-between"
|
||||
inputClassName="w-1/3"
|
||||
showDefault={false}
|
||||
/>
|
||||
<HoverCard openDelay={300}>
|
||||
<HoverCardTrigger className="grid w-full items-center gap-2">
|
||||
<div className="flex justify-between">
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import {
|
|||
HoverCardTrigger,
|
||||
} from '~/components/ui';
|
||||
import { cn, defaultTextProps, optionText, removeFocusOutlines } from '~/utils';
|
||||
import { DynamicTags } from '~/components/SidePanel/Parameters';
|
||||
import { DynamicTags, DynamicInputNumber } from '~/components/SidePanel/Parameters';
|
||||
import { useLocalize, useDebouncedInput } from '~/hooks';
|
||||
import type { TModelSelectProps } from '~/common';
|
||||
import OptionHover from './OptionHover';
|
||||
|
|
@ -154,6 +154,50 @@ export default function Settings({ conversation, setOption, models, readonly }:
|
|||
</div>
|
||||
</div>
|
||||
<div className="col-span-5 flex flex-col items-center justify-start gap-6 px-3 sm:col-span-2">
|
||||
<DynamicInputNumber
|
||||
columnSpan={2}
|
||||
settingKey="maxContextTokens"
|
||||
setOption={setOption}
|
||||
label="com_endpoint_context_tokens"
|
||||
labelCode={true}
|
||||
description="com_endpoint_context_info"
|
||||
descriptionCode={true}
|
||||
placeholder="com_nav_theme_system"
|
||||
placeholderCode={true}
|
||||
descriptionSide="right"
|
||||
conversation={conversation}
|
||||
readonly={readonly}
|
||||
range={{
|
||||
min: 10,
|
||||
max: 2000000,
|
||||
step: 1000,
|
||||
}}
|
||||
className="mt-1 w-full justify-between"
|
||||
inputClassName="w-1/3"
|
||||
showDefault={false}
|
||||
/>
|
||||
<DynamicInputNumber
|
||||
columnSpan={2}
|
||||
settingKey="max_tokens"
|
||||
setOption={setOption}
|
||||
label="com_endpoint_max_output_tokens"
|
||||
labelCode={true}
|
||||
description="com_endpoint_openai_max_tokens"
|
||||
descriptionCode={true}
|
||||
placeholder="com_nav_theme_system"
|
||||
placeholderCode={true}
|
||||
descriptionSide="top"
|
||||
conversation={conversation}
|
||||
readonly={readonly}
|
||||
range={{
|
||||
min: 10,
|
||||
max: 2000000,
|
||||
step: 1000,
|
||||
}}
|
||||
className="mt-1 w-full justify-between"
|
||||
inputClassName="w-1/3"
|
||||
showDefault={false}
|
||||
/>
|
||||
<HoverCard openDelay={300}>
|
||||
<HoverCardTrigger className="grid w-full items-center gap-2">
|
||||
<div className="flex justify-between">
|
||||
|
|
|
|||
|
|
@ -14,9 +14,16 @@ import {
|
|||
HoverCardTrigger,
|
||||
MultiSelectDropDown,
|
||||
} from '~/components/ui';
|
||||
import { cn, defaultTextProps, optionText, removeFocusOutlines } from '~/utils';
|
||||
import {
|
||||
cn,
|
||||
defaultTextProps,
|
||||
optionText,
|
||||
removeFocusOutlines,
|
||||
processPlugins,
|
||||
selectPlugins,
|
||||
} from '~/utils';
|
||||
import { DynamicInputNumber } from '~/components/SidePanel/Parameters';
|
||||
import { useLocalize, useDebouncedInput } from '~/hooks';
|
||||
import { processPlugins, selectPlugins } from '~/utils';
|
||||
import OptionHover from './OptionHover';
|
||||
import { ESide } from '~/common';
|
||||
import store from '~/store';
|
||||
|
|
@ -170,6 +177,28 @@ export default function Settings({
|
|||
containerClassName="flex w-full resize-none border border-transparent"
|
||||
labelClassName="dark:text-white"
|
||||
/>
|
||||
<DynamicInputNumber
|
||||
columnSpan={2}
|
||||
settingKey="maxContextTokens"
|
||||
setOption={setOption}
|
||||
label="com_endpoint_context_tokens"
|
||||
labelCode={true}
|
||||
description="com_endpoint_context_info"
|
||||
descriptionCode={true}
|
||||
placeholder="com_nav_theme_system"
|
||||
placeholderCode={true}
|
||||
descriptionSide="right"
|
||||
conversation={conversation}
|
||||
readonly={readonly}
|
||||
range={{
|
||||
min: 10,
|
||||
max: 2000000,
|
||||
step: 1000,
|
||||
}}
|
||||
className="mt-1 w-full justify-between"
|
||||
inputClassName="w-1/3"
|
||||
showDefault={false}
|
||||
/>
|
||||
<HoverCard openDelay={300}>
|
||||
<HoverCardTrigger className="grid w-full items-center gap-2">
|
||||
<div className="flex justify-between">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue