perf: model test;perf: sidebar trigger (#4127)

* fix: import dataset step error;perf: ai proxy avatar (#4074)

* perf: pg config params

* perf: ai proxy avatar

* fix: import dataset step error

* feat: data input ux

* perf: app dataset rewite

* perf: model test

* perf: sidebar trigger

* lock

* update nanoid version

* fix: select component ux

* fix: ts

* fix: vitest

* remove test
This commit is contained in:
Archer
2025-03-12 21:11:43 +08:00
committed by archer
parent c131c2a7dc
commit f71ab0caeb
64 changed files with 438 additions and 1356 deletions

View File

@@ -20,7 +20,7 @@ type Props = SelectProps & {
disableTip?: string;
};
const OneRowSelector = ({ list, onchange, disableTip, ...props }: Props) => {
const OneRowSelector = ({ list, onChange, disableTip, ...props }: Props) => {
const { t } = useTranslation();
const { llmModelList, embeddingModelList, ttsModelList, sttModelList, reRankModelList } =
useSystemStore();
@@ -96,12 +96,12 @@ const OneRowSelector = ({ list, onchange, disableTip, ...props }: Props) => {
placeholder={t('common:not_model_config')}
h={'40px'}
{...props}
onchange={(e) => {
onChange={(e) => {
if (e === 'price') {
onOpen();
return;
}
return onchange?.(e);
return onChange?.(e);
}}
/>
)}
@@ -110,7 +110,7 @@ const OneRowSelector = ({ list, onchange, disableTip, ...props }: Props) => {
</Box>
);
};
const MultipleRowSelector = ({ list, onchange, disableTip, placeholder, ...props }: Props) => {
const MultipleRowSelector = ({ list, onChange, disableTip, placeholder, ...props }: Props) => {
const { t } = useTranslation();
const { llmModelList, embeddingModelList, ttsModelList, sttModelList, reRankModelList } =
useSystemStore();
@@ -178,9 +178,9 @@ const MultipleRowSelector = ({ list, onchange, disableTip, placeholder, ...props
const onSelect = useCallback(
(e: string[]) => {
return onchange?.(e[1]);
return onChange?.(e[1]);
},
[onchange]
[onChange]
);
const SelectedModel = useMemo(() => {

View File

@@ -26,7 +26,7 @@ const I18nLngSelector = () => {
<MySelect
value={i18n.language}
list={list}
onchange={(val: any) => {
onChange={(val: any) => {
const lang = val;
onChangeLng(lang);
}}

View File

@@ -1,27 +1,35 @@
import React from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { Box, Flex } from '@chakra-ui/react';
import type { BoxProps } from '@chakra-ui/react';
import MyIcon from '@fastgpt/web/components/common/Icon';
interface Props extends BoxProps {
isFolded?: boolean;
onFoldChange?: (isFolded: boolean) => void;
externalTrigger?: Boolean;
}
const SideBar = (e?: Props) => {
const {
w = ['100%', '0 0 250px', '0 0 250px', '0 0 270px', '0 0 290px'],
children,
isFolded = false,
onFoldChange,
externalTrigger,
...props
} = e || {};
const handleToggle = () => {
if (onFoldChange) {
onFoldChange(!isFolded);
const [isFolded, setIsFolded] = useState(false);
// 保存上一次折叠状态
const preFoledStatus = useRef<Boolean>(false);
useEffect(() => {
if (externalTrigger) {
setIsFolded(true);
preFoledStatus.current = isFolded;
} else {
// @ts-ignore
setIsFolded(preFoledStatus.current);
}
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [externalTrigger]);
return (
<Box
@@ -58,7 +66,7 @@ const SideBar = (e?: Props) => {
visibility: 'hidden',
opacity: 0
})}
onClick={handleToggle}
onClick={() => setIsFolded(!isFolded)}
>
<MyIcon
name={'common/backLight'}

View File

@@ -154,7 +154,7 @@ const AIChatSettingsModal = ({
value: item.model,
label: item.name
}))}
onchange={onChangeModel}
onChange={onChangeModel}
/>
</Box>
</Flex>
@@ -385,7 +385,7 @@ const AIChatSettingsModal = ({
label: item
}))}
value={responseFormat}
onchange={(e) => {
onChange={(e) => {
setValue(NodeInputKeyEnum.aiChatResponseFormat, e);
}}
/>

View File

@@ -212,7 +212,7 @@ const ModelTable = () => {
w={'200px'}
bg={'myGray.50'}
value={provider}
onchange={setProvider}
onChange={setProvider}
list={filterProviderList}
/>
</HStack>
@@ -224,7 +224,7 @@ const ModelTable = () => {
w={'150px'}
bg={'myGray.50'}
value={modelType}
onchange={setModelType}
onChange={setModelType}
list={selectModelTypeList.current}
/>
</HStack>

View File

@@ -77,7 +77,7 @@ const SettingLLMModel = ({
value: item.model,
label: item.name
}))}
onchange={(e) => {
onChange={(e) => {
onChange({
...defaultData,
model: e

View File

@@ -290,7 +290,7 @@ const DatasetParamsModal = ({
width={'100%'}
value={queryExtensionModel}
list={chatModelSelectList}
onchange={(val: any) => {
onChange={(val: any) => {
setValue('datasetSearchExtensionModel', val);
}}
/>

View File

@@ -125,7 +125,7 @@ const QGConfigModal = ({
value: item.model,
label: item.name
}))}
onchange={(e) => {
onChange={(e) => {
onChange({
...value,
model: e

View File

@@ -80,7 +80,7 @@ export const VariableInputItem = ({
value: item.value
}))}
value={value}
onchange={(e) => setValue(`variables.${item.key}`, e)}
onChange={(e) => setValue(`variables.${item.key}`, e)}
/>
);
}}

View File

@@ -162,7 +162,7 @@ const RenderPluginInput = ({
}
if (inputType === FlowNodeInputTypeEnum.select && input.list) {
return (
<MySelect list={input.list} value={value} onchange={onChange} isDisabled={isDisabled} />
<MySelect list={input.list} value={value} onChange={onChange} isDisabled={isDisabled} />
);
}
if (inputType === FlowNodeInputTypeEnum.fileSelect) {
@@ -179,7 +179,7 @@ const RenderPluginInput = ({
value: item.model,
label: item.name
}))}
onchange={onChange}
onChange={onChange}
/>
);
}

View File

@@ -321,7 +321,7 @@ const RenderUserFormInteractive = React.memo(function RenderFormInput({
list={input.list}
value={value}
isDisabled={interactive.params.submitted}
onchange={(e) => setValue(input.label, e)}
onChange={(e) => setValue(input.label, e)}
/>
);
}}

View File

@@ -164,7 +164,7 @@ const LafAccountModal = ({
}
placeholder={t('common:plugin.App')}
value={watch('appid')}
onchange={(e) => {
onChange={(e) => {
setValue('appid', e);
}}
{...(register('appid'), { required: true })}

View File

@@ -49,7 +49,7 @@ const DefaultPermissionList = ({
<MySelect
list={defaultPermissionSelectList}
value={per}
onchange={(per) => {
onChange={(per) => {
if (isInheritPermission && hasParent) {
openConfirm(
() => onRequestChange(per),