mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-23 11:50:14 +01:00
✋ feat: Stop Sequences for Conversations & Presets (#2536)
* feat: `stop` conversation parameter * feat: Tag primitive * feat: dynamic tags * refactor: update tag styling * feat: add stop sequences to OpenAI settings * fix(Presentation): prevent `SidePanel` re-renders that flicker side panel * refactor: use stop placeholder * feat: type and schema update for `stop` and `TPreset` in generation param related types * refactor: pass conversation to dynamic settings * refactor(OpenAIClient): remove default handling for `modelOptions.stop` * docs: fix Google AI Setup formatting * feat: current_model * docs: WIP update * fix(ChatRoute): prevent default preset override before `hasSetConversation.current` becomes true by including latest conversation state as template * docs: update docs with more info on `stop` * chore: bump config_version * refactor: CURRENT_MODEL handling
This commit is contained in:
parent
4121818124
commit
099aa9dead
29 changed files with 690 additions and 93 deletions
|
|
@ -27,9 +27,7 @@ export default function Settings({
|
|||
|
||||
if (OptionComponent) {
|
||||
return (
|
||||
<div
|
||||
className={cn('hide-scrollbar h-[500px] overflow-y-auto md:mb-2 md:h-[350px]', className)}
|
||||
>
|
||||
<div className={cn('h-[500px] overflow-y-auto md:mb-2 md:h-[350px]', className)}>
|
||||
<OptionComponent
|
||||
conversation={conversation}
|
||||
setOption={setOption}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
import { useMemo } from 'react';
|
||||
import TextareaAutosize from 'react-textarea-autosize';
|
||||
import { ImageDetail, imageDetailNumeric, imageDetailValue } from 'librechat-data-provider';
|
||||
import * as InputNumberPrimitive from 'rc-input-number';
|
||||
import {
|
||||
EModelEndpoint,
|
||||
ImageDetail,
|
||||
imageDetailNumeric,
|
||||
imageDetailValue,
|
||||
} from 'librechat-data-provider';
|
||||
import {
|
||||
Input,
|
||||
Label,
|
||||
|
|
@ -10,12 +17,15 @@ import {
|
|||
SelectDropDown,
|
||||
HoverCardTrigger,
|
||||
} from '~/components/ui';
|
||||
import { cn, defaultTextProps, optionText, removeFocusOutlines } from '~/utils/';
|
||||
import { cn, defaultTextProps, optionText, removeFocusOutlines } from '~/utils';
|
||||
import { DynamicTags } from '~/components/SidePanel/Parameters';
|
||||
import { useLocalize, useDebouncedInput } from '~/hooks';
|
||||
import type { TModelSelectProps } from '~/common';
|
||||
import OptionHover from './OptionHover';
|
||||
import { ESide } from '~/common';
|
||||
|
||||
type OnInputNumberChange = InputNumberPrimitive.InputNumberProps['onChange'];
|
||||
|
||||
export default function Settings({ conversation, setOption, models, readonly }: TModelSelectProps) {
|
||||
const localize = useLocalize();
|
||||
const {
|
||||
|
|
@ -62,6 +72,12 @@ export default function Settings({ conversation, setOption, models, readonly }:
|
|||
initialValue: presP,
|
||||
});
|
||||
|
||||
const optionEndpoint = useMemo(() => endpointType ?? endpoint, [endpoint, endpointType]);
|
||||
const isOpenAI = useMemo(
|
||||
() => optionEndpoint === EModelEndpoint.openAI || optionEndpoint === EModelEndpoint.azureOpenAI,
|
||||
[optionEndpoint],
|
||||
);
|
||||
|
||||
if (!conversation) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -70,8 +86,6 @@ export default function Settings({ conversation, setOption, models, readonly }:
|
|||
const setResendFiles = setOption('resendFiles');
|
||||
const setImageDetail = setOption('imageDetail');
|
||||
|
||||
const optionEndpoint = endpointType ?? endpoint;
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-5 gap-6">
|
||||
<div className="col-span-5 flex flex-col items-center justify-start gap-6 sm:col-span-3">
|
||||
|
|
@ -120,6 +134,22 @@ export default function Settings({ conversation, setOption, models, readonly }:
|
|||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="grid w-full items-start gap-2">
|
||||
<DynamicTags
|
||||
settingKey="stop"
|
||||
setOption={setOption}
|
||||
label="com_endpoint_stop"
|
||||
labelCode={true}
|
||||
description="com_endpoint_openai_stop"
|
||||
descriptionCode={true}
|
||||
placeholder="com_endpoint_stop_placeholder"
|
||||
placeholderCode={true}
|
||||
descriptionSide="right"
|
||||
maxTags={isOpenAI ? 4 : undefined}
|
||||
conversation={conversation}
|
||||
readonly={readonly}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-span-5 flex flex-col items-center justify-start gap-6 px-3 sm:col-span-2">
|
||||
<HoverCard openDelay={300}>
|
||||
|
|
@ -133,9 +163,10 @@ export default function Settings({ conversation, setOption, models, readonly }:
|
|||
</Label>
|
||||
<InputNumber
|
||||
id="temp-int"
|
||||
stringMode={false}
|
||||
disabled={readonly}
|
||||
value={temperatureValue as number}
|
||||
onChange={setTemperature}
|
||||
onChange={setTemperature as OnInputNumberChange}
|
||||
max={2}
|
||||
min={0}
|
||||
step={0.01}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue