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:
@@ -43,7 +43,7 @@
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"lodash": "^4.17.21",
|
||||
"mermaid": "^10.2.3",
|
||||
"nanoid": "^4.0.1",
|
||||
"nanoid": "^5.1.3",
|
||||
"next": "14.2.21",
|
||||
"next-i18next": "15.3.0",
|
||||
"nextjs-node-loader": "^1.1.5",
|
||||
@@ -84,6 +84,7 @@
|
||||
"eslint": "8.56.0",
|
||||
"eslint-config-next": "14.2.3",
|
||||
"nextjs-node-loader": "^1.1.5",
|
||||
"typescript": "^5.1.3"
|
||||
"typescript": "^5.1.3",
|
||||
"vitest": "^3.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -26,7 +26,7 @@ const I18nLngSelector = () => {
|
||||
<MySelect
|
||||
value={i18n.language}
|
||||
list={list}
|
||||
onchange={(val: any) => {
|
||||
onChange={(val: any) => {
|
||||
const lang = val;
|
||||
onChangeLng(lang);
|
||||
}}
|
||||
|
||||
@@ -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'}
|
||||
|
||||
@@ -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);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -77,7 +77,7 @@ const SettingLLMModel = ({
|
||||
value: item.model,
|
||||
label: item.name
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
onChange({
|
||||
...defaultData,
|
||||
model: e
|
||||
|
||||
@@ -290,7 +290,7 @@ const DatasetParamsModal = ({
|
||||
width={'100%'}
|
||||
value={queryExtensionModel}
|
||||
list={chatModelSelectList}
|
||||
onchange={(val: any) => {
|
||||
onChange={(val: any) => {
|
||||
setValue('datasetSearchExtensionModel', val);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -125,7 +125,7 @@ const QGConfigModal = ({
|
||||
value: item.model,
|
||||
label: item.name
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
onChange({
|
||||
...value,
|
||||
model: e
|
||||
|
||||
@@ -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)}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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)}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
|
||||
@@ -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 })}
|
||||
|
||||
@@ -49,7 +49,7 @@ const DefaultPermissionList = ({
|
||||
<MySelect
|
||||
list={defaultPermissionSelectList}
|
||||
value={per}
|
||||
onchange={(per) => {
|
||||
onChange={(per) => {
|
||||
if (isInheritPermission && hasParent) {
|
||||
openConfirm(
|
||||
() => onRequestChange(per),
|
||||
|
||||
@@ -46,48 +46,21 @@ const TeamSelector = ({
|
||||
|
||||
const teamList = useMemo(() => {
|
||||
return myTeams.map((team) => ({
|
||||
label: (
|
||||
<Flex
|
||||
key={team.teamId}
|
||||
alignItems={'center'}
|
||||
borderRadius={'md'}
|
||||
cursor={'default'}
|
||||
gap={3}
|
||||
onClick={() => onSwitchTeam(team.teamId)}
|
||||
_hover={{
|
||||
cursor: 'pointer'
|
||||
}}
|
||||
>
|
||||
<Avatar src={team.avatar} w={['1.25rem', '1.375rem']} />
|
||||
<Box flex={'1 0 0'} w={0} className="textEllipsis" fontSize={'sm'}>
|
||||
{team.teamName}
|
||||
</Box>
|
||||
</Flex>
|
||||
),
|
||||
icon: team.avatar,
|
||||
iconSize: '1.25rem',
|
||||
label: team.teamName,
|
||||
value: team.teamId
|
||||
}));
|
||||
}, [myTeams, onSwitchTeam]);
|
||||
}, [myTeams]);
|
||||
|
||||
const formatTeamList = useMemo(() => {
|
||||
return [
|
||||
...(showManage
|
||||
? [
|
||||
{
|
||||
label: (
|
||||
<Flex
|
||||
key={'manage'}
|
||||
alignItems={'center'}
|
||||
borderRadius={'md'}
|
||||
cursor={'pointer'}
|
||||
gap={3}
|
||||
onClick={() => router.push('/account/team')}
|
||||
>
|
||||
<MyIcon name="common/setting" w={['1.25rem', '1.375rem']} />
|
||||
<Box flex={'1 0 0'} w={0} className="textEllipsis" fontSize={'sm'}>
|
||||
{t('user:manage_team')}
|
||||
</Box>
|
||||
</Flex>
|
||||
),
|
||||
icon: 'common/setting',
|
||||
iconSize: '1.25rem',
|
||||
label: t('user:manage_team'),
|
||||
value: 'manage',
|
||||
showBorder: true
|
||||
}
|
||||
@@ -95,11 +68,24 @@ const TeamSelector = ({
|
||||
: []),
|
||||
...teamList
|
||||
];
|
||||
}, [showManage, t, teamList, router]);
|
||||
}, [showManage, t, teamList]);
|
||||
|
||||
const handleChange = (value: string) => {
|
||||
if (value === 'manage') {
|
||||
router.push('/account/team');
|
||||
} else {
|
||||
onSwitchTeam(value);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Box w={'100%'}>
|
||||
<MySelect {...props} value={userInfo?.team?.teamId} list={formatTeamList} />
|
||||
<MySelect
|
||||
{...props}
|
||||
value={userInfo?.team?.teamId}
|
||||
list={formatTeamList}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -111,7 +111,7 @@ const BillTable = () => {
|
||||
list={billTypeList}
|
||||
value={billType}
|
||||
size={'sm'}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setBillType(e);
|
||||
}}
|
||||
w={'130px'}
|
||||
|
||||
@@ -213,7 +213,7 @@ export const ModelEditModal = ({
|
||||
<Td textAlign={'right'}>
|
||||
<MySelect
|
||||
value={provider}
|
||||
onchange={(value) => setValue('provider', value)}
|
||||
onChange={(value) => setValue('provider', value)}
|
||||
list={providerList.current}
|
||||
{...InputStyles}
|
||||
/>
|
||||
|
||||
@@ -194,7 +194,7 @@ const EditChannelModal = ({
|
||||
placeholder={t('account_model:select_provider_placeholder')}
|
||||
value={providerType}
|
||||
isSearch
|
||||
onchange={(val) => {
|
||||
onChange={(val) => {
|
||||
setValue('type', val);
|
||||
}}
|
||||
/>
|
||||
@@ -333,6 +333,8 @@ const MultipleSelect = ({ value = [], list = [], onSelect }: SelectProps) => {
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const { copyData } = useCopyData();
|
||||
|
||||
const [search, setSearch] = useState('');
|
||||
|
||||
const onclickItem = useCallback(
|
||||
(val: string) => {
|
||||
if (value.includes(val)) {
|
||||
@@ -343,12 +345,11 @@ const MultipleSelect = ({ value = [], list = [], onSelect }: SelectProps) => {
|
||||
top: BoxRef.current.scrollHeight
|
||||
});
|
||||
}
|
||||
setSearch('');
|
||||
},
|
||||
[value, onSelect]
|
||||
);
|
||||
|
||||
const [search, setSearch] = useState('');
|
||||
|
||||
const filterUnSelected = useMemo(() => {
|
||||
return list
|
||||
.filter((item) => !value.includes(item.value))
|
||||
|
||||
@@ -25,6 +25,7 @@ import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import { batchRun } from '@fastgpt/global/common/system/utils';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import MyIconButton from '@fastgpt/web/components/common/Icon/button';
|
||||
|
||||
type ModelTestItem = {
|
||||
label: React.ReactNode;
|
||||
@@ -143,13 +144,47 @@ const ModelTest = ({
|
||||
refreshDeps: [testModelList]
|
||||
}
|
||||
);
|
||||
const { runAsync: onTestOneModel, loading: testingOneModel } = useRequest2(
|
||||
async (model: string) => {
|
||||
const start = Date.now();
|
||||
|
||||
setTestModelList((prev) =>
|
||||
prev.map((item) =>
|
||||
item.model === model ? { ...item, status: 'running', message: '' } : item
|
||||
)
|
||||
);
|
||||
|
||||
try {
|
||||
await getTestModel({ model, channelId });
|
||||
const duration = Date.now() - start;
|
||||
|
||||
setTestModelList((prev) =>
|
||||
prev.map((item) =>
|
||||
item.model === model ? { ...item, status: 'success', duration: duration / 1000 } : item
|
||||
)
|
||||
);
|
||||
} catch (error) {
|
||||
setTestModelList((prev) =>
|
||||
prev.map((item) =>
|
||||
item.model === model ? { ...item, status: 'error', message: getErrText(error) } : item
|
||||
)
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
manual: true
|
||||
}
|
||||
);
|
||||
|
||||
const isTestLoading = testingOneModel || isTesting;
|
||||
|
||||
return (
|
||||
<MyModal
|
||||
iconSrc={'core/chat/sendLight'}
|
||||
isLoading={loadingModels}
|
||||
title={t('account_model:model_test')}
|
||||
w={'600px'}
|
||||
w={'100%'}
|
||||
maxW={['90vw', '1090px']}
|
||||
isOpen
|
||||
>
|
||||
<ModalBody>
|
||||
@@ -157,8 +192,10 @@ const ModelTest = ({
|
||||
<Table>
|
||||
<Thead>
|
||||
<Tr>
|
||||
<Th>{t('account_model:model')}</Th>
|
||||
<Th>{t('account_model:model_name')}</Th>
|
||||
<Th>{t('account:model.model_id')}</Th>
|
||||
<Th>{t('account_model:channel_status')}</Th>
|
||||
<Th></Th>
|
||||
</Tr>
|
||||
</Thead>
|
||||
<Tbody>
|
||||
@@ -167,6 +204,7 @@ const ModelTest = ({
|
||||
return (
|
||||
<Tr key={item.model}>
|
||||
<Td>{item.label}</Td>
|
||||
<Td>{item.model}</Td>
|
||||
<Td>
|
||||
<Flex alignItems={'center'}>
|
||||
<MyTag mr={1} type="borderSolid" colorSchema={data.colorSchema as any}>
|
||||
@@ -182,6 +220,16 @@ const ModelTest = ({
|
||||
)}
|
||||
</Flex>
|
||||
</Td>
|
||||
<Td>
|
||||
<MyIconButton
|
||||
isLoading={isTestLoading}
|
||||
icon={'core/chat/sendLight'}
|
||||
tip={t('account:model.test_model')}
|
||||
onClick={() => {
|
||||
onTestOneModel(item.model);
|
||||
}}
|
||||
/>
|
||||
</Td>
|
||||
</Tr>
|
||||
);
|
||||
})}
|
||||
@@ -193,7 +241,7 @@ const ModelTest = ({
|
||||
<Button mr={4} variant={'whiteBase'} onClick={onClose}>
|
||||
{t('common:common.Cancel')}
|
||||
</Button>
|
||||
<Button isLoading={isTesting} variant={'primary'} onClick={onStartTest}>
|
||||
<Button isLoading={isTestLoading} variant={'primary'} onClick={onStartTest}>
|
||||
{t('account_model:start_test', { num: testModelList.length })}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
|
||||
@@ -206,7 +206,7 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
list={channelList}
|
||||
placeholder={t('account_model:select_channel')}
|
||||
value={filterProps.channelId}
|
||||
onchange={(val) => setFilterProps({ ...filterProps, channelId: val })}
|
||||
onChange={(val) => setFilterProps({ ...filterProps, channelId: val })}
|
||||
/>
|
||||
</Box>
|
||||
</HStack>
|
||||
@@ -219,7 +219,7 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
list={modelList}
|
||||
placeholder={t('account_model:select_model')}
|
||||
value={filterProps.model}
|
||||
onchange={(val) => setFilterProps({ ...filterProps, model: val })}
|
||||
onChange={(val) => setFilterProps({ ...filterProps, model: val })}
|
||||
/>
|
||||
</Box>
|
||||
</HStack>
|
||||
@@ -234,7 +234,7 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
{ label: t('common:common.failed'), value: 'error' }
|
||||
]}
|
||||
value={filterProps.code_type}
|
||||
onchange={(val) => setFilterProps({ ...filterProps, code_type: val })}
|
||||
onChange={(val) => setFilterProps({ ...filterProps, code_type: val })}
|
||||
/>
|
||||
</Box>
|
||||
</HStack>
|
||||
|
||||
@@ -326,7 +326,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
w={'200px'}
|
||||
bg={'myGray.50'}
|
||||
value={provider}
|
||||
onchange={setProvider}
|
||||
onChange={setProvider}
|
||||
list={filterProviderList}
|
||||
/>
|
||||
</HStack>
|
||||
@@ -338,7 +338,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
w={'150px'}
|
||||
bg={'myGray.50'}
|
||||
value={modelType}
|
||||
onchange={setModelType}
|
||||
onChange={setModelType}
|
||||
list={selectModelTypeList.current}
|
||||
/>
|
||||
</HStack>
|
||||
@@ -436,7 +436,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
|
||||
<MyIconButton
|
||||
icon={'core/chat/sendLight'}
|
||||
tip={t('account:model.test_model')}
|
||||
onClick={() => onTestModel(item.model)}
|
||||
onClick={() => onTestModel({ model: item.model })}
|
||||
/>
|
||||
<MyIconButton
|
||||
icon={'common/settingLight'}
|
||||
@@ -597,7 +597,7 @@ const DefaultModelModal = ({
|
||||
value: item.model,
|
||||
label: item.name
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setDefaultData((state) => ({
|
||||
...state,
|
||||
llm: llmModelList.find((item) => item.model === e)
|
||||
@@ -616,7 +616,7 @@ const DefaultModelModal = ({
|
||||
value: item.model,
|
||||
label: item.name
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setDefaultData((state) => ({
|
||||
...state,
|
||||
embedding: embeddingModelList.find((item) => item.model === e)
|
||||
@@ -635,7 +635,7 @@ const DefaultModelModal = ({
|
||||
value: item.model,
|
||||
label: item.name
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setDefaultData((state) => ({
|
||||
...state,
|
||||
tts: ttsModelList.find((item) => item.model === e)
|
||||
@@ -654,7 +654,7 @@ const DefaultModelModal = ({
|
||||
value: item.model,
|
||||
label: item.name
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setDefaultData((state) => ({
|
||||
...state,
|
||||
stt: sttModelList.find((item) => item.model === e)
|
||||
@@ -673,7 +673,7 @@ const DefaultModelModal = ({
|
||||
value: item.model,
|
||||
label: item.name
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setDefaultData((state) => ({
|
||||
...state,
|
||||
rerank: reRankModelList.find((item) => item.model === e)
|
||||
@@ -696,7 +696,7 @@ const DefaultModelModal = ({
|
||||
value: item.model,
|
||||
label: item.name
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setDefaultData((state) => ({
|
||||
...state,
|
||||
datasetTextLLM: datasetModelList.find((item) => item.model === e)
|
||||
@@ -718,7 +718,7 @@ const DefaultModelModal = ({
|
||||
value: item.model,
|
||||
label: item.name
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setDefaultData((state) => ({
|
||||
...state,
|
||||
datasetImageLLM: vlmModelList.find((item) => item.model === e)
|
||||
|
||||
@@ -71,7 +71,7 @@ function CreateInvitationModal({ onClose }: { onClose: () => void }) {
|
||||
<MySelect
|
||||
list={expiresOptions}
|
||||
value={expires}
|
||||
onchange={(val) => setValue('expires', val)}
|
||||
onChange={(val) => setValue('expires', val)}
|
||||
minW="120px"
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -84,7 +84,7 @@ const ExtractFieldModal = ({
|
||||
<MySelect<string>
|
||||
list={toolValueTypeList}
|
||||
value={valueType}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setValue('valueType', e as any);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -217,7 +217,7 @@ const RenderHttpMethodAndUrl = React.memo(function RenderHttpMethodAndUrl({
|
||||
value: 'PATCH'
|
||||
}
|
||||
]}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
onChangeNode({
|
||||
nodeId,
|
||||
type: 'updateInput',
|
||||
|
||||
@@ -396,7 +396,7 @@ const ConditionSelect = ({
|
||||
w={'100%'}
|
||||
list={filterQuiredConditionList}
|
||||
value={condition}
|
||||
onchange={onSelect}
|
||||
onChange={onSelect}
|
||||
placeholder={t('common:chose_condition')}
|
||||
/>
|
||||
);
|
||||
@@ -441,7 +441,7 @@ const ConditionValueInput = ({
|
||||
{ label: 'True', value: 'true' },
|
||||
{ label: 'False', value: 'false' }
|
||||
]}
|
||||
onchange={onChange}
|
||||
onChange={onChange}
|
||||
value={value}
|
||||
placeholder={workflowT('ifelse.Select value')}
|
||||
isDisabled={
|
||||
|
||||
@@ -235,7 +235,7 @@ const NodeLaf = (props: NodeProps<FlowNodeItemType>) => {
|
||||
isLoading={isLoadingFunctions}
|
||||
list={lafFunctionSelectList}
|
||||
placeholder={t('common:core.module.laf.Select laf function')}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
onChangeNode({
|
||||
nodeId,
|
||||
type: 'updateInput',
|
||||
|
||||
@@ -209,7 +209,7 @@ const InputTypeConfig = ({
|
||||
(item) => item.value !== WorkflowIOValueTypeEnum.arrayAny
|
||||
)}
|
||||
value={valueType}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setValue('valueType', e);
|
||||
}}
|
||||
/>
|
||||
@@ -346,7 +346,7 @@ const InputTypeConfig = ({
|
||||
? defaultValue
|
||||
: ''
|
||||
}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setValue('defaultValue', e);
|
||||
}}
|
||||
w={'200px'}
|
||||
|
||||
@@ -144,7 +144,7 @@ const PluginOutputEditModal = ({
|
||||
(item) => item.value !== WorkflowIOValueTypeEnum.arrayAny
|
||||
)}
|
||||
value={valueType}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setValue('valueType', e);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -123,7 +123,7 @@ const ToolParamsEditModal = ({
|
||||
<MySelect
|
||||
list={toolValueTypeList}
|
||||
value={valueType}
|
||||
onchange={(e: any) => {
|
||||
onChange={(e: any) => {
|
||||
setValue('valueType', e);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -137,7 +137,7 @@ const FieldModal = ({
|
||||
(item) => item.value !== WorkflowIOValueTypeEnum.arrayAny
|
||||
)}
|
||||
value={valueType}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setValue('valueType', e);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -14,7 +14,7 @@ const SelectRender = ({ item, nodeId }: RenderInputProps) => {
|
||||
width={'100%'}
|
||||
value={item.value}
|
||||
list={item.list || []}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
onChangeNode({
|
||||
nodeId,
|
||||
type: 'updateInput',
|
||||
|
||||
@@ -57,7 +57,7 @@ const SelectAiModelRender = ({ item, nodeId }: RenderInputProps) => {
|
||||
value: item.model,
|
||||
label: item.name
|
||||
}))}
|
||||
onchange={onChangeModel}
|
||||
onChange={onChangeModel}
|
||||
/>
|
||||
);
|
||||
}, [item.value, modelList, onChangeModel]);
|
||||
|
||||
@@ -201,7 +201,7 @@ const EditModal = ({ onClose, ...props }: RenderInputProps & { onClose: () => vo
|
||||
description: t('workflow:dataset_quote_role_user_option_desc')
|
||||
}
|
||||
]}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setValue('quoteRole', e);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -131,7 +131,7 @@ const FieldModal = ({
|
||||
(item) => item.value !== WorkflowIOValueTypeEnum.arrayAny
|
||||
)}
|
||||
value={valueType}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setValue('valueType', e);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -97,7 +97,7 @@ const EditFieldModal = ({
|
||||
<MySelect
|
||||
list={toolValueTypeList}
|
||||
value={valueType}
|
||||
onchange={(e: any) => {
|
||||
onChange={(e: any) => {
|
||||
setValue('valueType', e);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -289,7 +289,7 @@ const TemplateMarketModal = ({
|
||||
<MySelect<TemplateAppType>
|
||||
h={'8'}
|
||||
value={currentAppType}
|
||||
onchange={(value) => {
|
||||
onChange={(value) => {
|
||||
setCurrentAppType(value);
|
||||
}}
|
||||
bg={'myGray.100'}
|
||||
|
||||
@@ -333,7 +333,7 @@ function DataProcess() {
|
||||
label: item.name,
|
||||
value: item.model
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setValue('llmModel', e);
|
||||
}}
|
||||
/>
|
||||
@@ -349,7 +349,7 @@ function DataProcess() {
|
||||
label: item.name,
|
||||
value: item.model
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setValue('vlmModel', e);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -195,7 +195,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
||||
label: item.name,
|
||||
value: item.model
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
const vectorModel = embeddingModelList.find((item) => item.model === e);
|
||||
if (!vectorModel) return;
|
||||
return onOpenConfirmRebuild(async () => {
|
||||
@@ -220,7 +220,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
||||
value: item.model
|
||||
}))}
|
||||
fontSize={'mini'}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
const agentModel = datasetModelList.find((item) => item.model === e);
|
||||
if (!agentModel) return;
|
||||
setValue('agentModel', agentModel);
|
||||
@@ -244,7 +244,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
||||
value: item.model
|
||||
}))}
|
||||
fontSize={'mini'}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
const vlmModel = vllmModelList.find((item) => item.model === e);
|
||||
if (!vlmModel) return;
|
||||
setValue('vlmModel', vlmModel);
|
||||
|
||||
@@ -186,7 +186,7 @@ const Test = ({ datasetId }: { datasetId: string }) => {
|
||||
// }
|
||||
]}
|
||||
value={inputType}
|
||||
onchange={(e) => setInputType(e)}
|
||||
onChange={(e) => setInputType(e)}
|
||||
/>
|
||||
|
||||
<Button
|
||||
|
||||
@@ -205,7 +205,7 @@ const CreateModal = ({
|
||||
label: item.name,
|
||||
value: item.model
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setValue('vectorModel' as const, e);
|
||||
}}
|
||||
/>
|
||||
@@ -237,7 +237,7 @@ const CreateModal = ({
|
||||
label: item.name,
|
||||
value: item.model
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setValue('agentModel', e);
|
||||
}}
|
||||
/>
|
||||
@@ -269,7 +269,7 @@ const CreateModal = ({
|
||||
label: item.name,
|
||||
value: item.model
|
||||
}))}
|
||||
onchange={(e) => {
|
||||
onChange={(e) => {
|
||||
setValue('vlmModel', e);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import React, { useCallback, useEffect, useMemo } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Flex,
|
||||
@@ -44,6 +44,7 @@ import { useRouter } from 'next/router';
|
||||
import TeamSelector from '@/pageComponents/account/TeamSelector';
|
||||
import { getWorkorderURL } from '@/web/common/workorder/api';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useMount } from 'ahooks';
|
||||
|
||||
const StandDetailModal = dynamic(
|
||||
() => import('@/pageComponents/account/info/standardDetailModal'),
|
||||
@@ -64,7 +65,9 @@ const Info = () => {
|
||||
const standardPlan = teamPlanStatus?.standardConstants;
|
||||
const { isOpen: isOpenContact, onClose: onCloseContact, onOpen: onOpenContact } = useDisclosure();
|
||||
|
||||
useQuery(['init'], initUserInfo);
|
||||
useMount(() => {
|
||||
initUserInfo();
|
||||
});
|
||||
|
||||
return (
|
||||
<AccountContainer>
|
||||
|
||||
@@ -130,7 +130,7 @@ const UsageTable = () => {
|
||||
{ label: t('account_usage:every_month'), value: 'month' }
|
||||
]}
|
||||
value={unit}
|
||||
onchange={setUnit}
|
||||
onChange={setUnit}
|
||||
/>
|
||||
)} */}
|
||||
</Flex>
|
||||
|
||||
@@ -132,14 +132,12 @@ const testTTSModel = async (model: TTSModelType, headers: Record<string, string>
|
||||
model.requestUrl
|
||||
? {
|
||||
path: model.requestUrl,
|
||||
headers: model.requestAuth
|
||||
? {
|
||||
Authorization: `Bearer ${model.requestAuth}`,
|
||||
...headers
|
||||
}
|
||||
: headers
|
||||
headers: {
|
||||
...(model.requestAuth ? { Authorization: `Bearer ${model.requestAuth}` } : {}),
|
||||
...headers
|
||||
}
|
||||
}
|
||||
: {}
|
||||
: { headers }
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -27,6 +27,13 @@ async function handler(
|
||||
const dbModel = await MongoSystemModel.findOne({ model }).lean();
|
||||
const modelData = findModelFromAlldata(model);
|
||||
|
||||
if (metadata) {
|
||||
delete metadata.isActive;
|
||||
delete metadata.isDefault;
|
||||
delete metadata.isDefaultDatasetTextModel;
|
||||
delete metadata.isDefaultDatasetImageModel;
|
||||
}
|
||||
|
||||
const metadataConcat: Record<string, any> = {
|
||||
...modelData, // system config
|
||||
...dbModel?.metadata, // db config
|
||||
|
||||
@@ -19,6 +19,7 @@ import { concatPer } from '@fastgpt/service/support/permission/controller';
|
||||
import { getGroupsByTmbId } from '@fastgpt/service/support/permission/memberGroup/controllers';
|
||||
import { getOrgIdSetWithParentByTmbId } from '@fastgpt/service/support/permission/org/controllers';
|
||||
import { addSourceMember } from '@fastgpt/service/support/user/utils';
|
||||
import { getNanoid } from '../../../../../../../packages/global/common/string/tools';
|
||||
|
||||
export type ListAppBody = {
|
||||
parentId?: ParentIdType;
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
import { MongoApp } from '@fastgpt/service/core/app/schema';
|
||||
import { MongoAppVersion } from '@fastgpt/service/core/app/version/schema';
|
||||
import { getRootUser } from '@test/datas/users';
|
||||
import { Call } from '@test/utils/request';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import handler, { type versionListBody, type versionListResponse } from './list';
|
||||
|
||||
describe('app version list test', () => {
|
||||
it('should return app version list', async () => {
|
||||
const root = await getRootUser();
|
||||
const app = await MongoApp.create({
|
||||
name: 'test',
|
||||
tmbId: root.tmbId,
|
||||
teamId: root.teamId
|
||||
});
|
||||
await MongoAppVersion.create(
|
||||
[...Array(10).keys()].map((i) => ({
|
||||
tmbId: root.tmbId,
|
||||
appId: app._id,
|
||||
versionName: `v${i}`
|
||||
}))
|
||||
);
|
||||
const res = await Call<versionListBody, {}, versionListResponse>(handler, {
|
||||
auth: root,
|
||||
body: {
|
||||
pageSize: 10,
|
||||
offset: 0,
|
||||
appId: app._id
|
||||
}
|
||||
});
|
||||
expect(res.code).toBe(200);
|
||||
expect(res.data.total).toBe(10);
|
||||
expect(res.data.list.length).toBe(10);
|
||||
});
|
||||
});
|
||||
@@ -65,14 +65,6 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
|
||||
const chatRecords = useContextSelector(ChatRecordContext, (v) => v.chatRecords);
|
||||
const totalRecordsCount = useContextSelector(ChatRecordContext, (v) => v.totalRecordsCount);
|
||||
|
||||
const [sidebarFolded, setSidebarFolded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (quoteData) {
|
||||
setSidebarFolded(true);
|
||||
}
|
||||
}, [quoteData]);
|
||||
|
||||
// Load chat init data
|
||||
const { loading } = useRequest2(
|
||||
async () => {
|
||||
@@ -156,9 +148,7 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
|
||||
);
|
||||
|
||||
return isPc || !appId ? (
|
||||
<SideBar isFolded={sidebarFolded} onFoldChange={setSidebarFolded}>
|
||||
{Children}
|
||||
</SideBar>
|
||||
<SideBar externalTrigger={!!quoteData}>{Children}</SideBar>
|
||||
) : (
|
||||
<Drawer
|
||||
isOpen={isOpenSlider}
|
||||
@@ -171,7 +161,7 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
|
||||
<DrawerContent maxWidth={'75vw'}>{Children}</DrawerContent>
|
||||
</Drawer>
|
||||
);
|
||||
}, [t, isPc, appId, isOpenSlider, onCloseSlider, sidebarFolded]);
|
||||
}, [t, isPc, appId, isOpenSlider, onCloseSlider, quoteData]);
|
||||
|
||||
return (
|
||||
<Flex h={'100%'}>
|
||||
|
||||
@@ -90,14 +90,6 @@ const OutLink = (props: Props) => {
|
||||
const totalRecordsCount = useContextSelector(ChatRecordContext, (v) => v.totalRecordsCount);
|
||||
const isChatRecordsLoaded = useContextSelector(ChatRecordContext, (v) => v.isChatRecordsLoaded);
|
||||
|
||||
const [sidebarFolded, setSidebarFolded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (quoteData) {
|
||||
setSidebarFolded(true);
|
||||
}
|
||||
}, [quoteData]);
|
||||
|
||||
const initSign = useRef(false);
|
||||
const { data, loading } = useRequest2(
|
||||
async () => {
|
||||
@@ -229,9 +221,7 @@ const OutLink = (props: Props) => {
|
||||
if (showHistory !== '1') return null;
|
||||
|
||||
return isPc ? (
|
||||
<SideBar isFolded={sidebarFolded} onFoldChange={setSidebarFolded}>
|
||||
{Children}
|
||||
</SideBar>
|
||||
<SideBar externalTrigger={!!quoteData}>{Children}</SideBar>
|
||||
) : (
|
||||
<Drawer
|
||||
isOpen={isOpenSlider}
|
||||
@@ -246,7 +236,7 @@ const OutLink = (props: Props) => {
|
||||
</DrawerContent>
|
||||
</Drawer>
|
||||
);
|
||||
}, [isOpenSlider, isPc, onCloseSlider, showHistory, t, sidebarFolded]);
|
||||
}, [isOpenSlider, isPc, onCloseSlider, quoteData, showHistory, t]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import React, { useCallback, useEffect, useMemo } from 'react';
|
||||
import NextHead from '@/components/common/NextHead';
|
||||
import { getTeamChatInfo } from '@/web/core/chat/api';
|
||||
import { useRouter } from 'next/router';
|
||||
@@ -70,14 +70,6 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
|
||||
const chatRecords = useContextSelector(ChatRecordContext, (v) => v.chatRecords);
|
||||
const totalRecordsCount = useContextSelector(ChatRecordContext, (v) => v.totalRecordsCount);
|
||||
|
||||
const [sidebarFolded, setSidebarFolded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (quoteData) {
|
||||
setSidebarFolded(true);
|
||||
}
|
||||
}, [quoteData]);
|
||||
|
||||
// get chat app info
|
||||
const { loading } = useRequest2(
|
||||
async () => {
|
||||
@@ -174,9 +166,7 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
|
||||
);
|
||||
|
||||
return isPc || !appId ? (
|
||||
<SideBar isFolded={sidebarFolded} onFoldChange={setSidebarFolded}>
|
||||
{Children}
|
||||
</SideBar>
|
||||
<SideBar externalTrigger={!!quoteData}>{Children}</SideBar>
|
||||
) : (
|
||||
<Drawer
|
||||
isOpen={isOpenSlider}
|
||||
@@ -189,7 +179,7 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
|
||||
<DrawerContent maxWidth={'75vw'}>{Children}</DrawerContent>
|
||||
</Drawer>
|
||||
);
|
||||
}, [appId, isOpenSlider, isPc, onCloseSlider, t, sidebarFolded]);
|
||||
}, [appId, isOpenSlider, isPc, onCloseSlider, quoteData, t]);
|
||||
|
||||
return (
|
||||
<Flex h={'100%'}>
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
"@test/*": ["../../test/*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.d.ts", "../../packages/**/*.d.ts"],
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
"**/*.d.ts",
|
||||
"../../packages/**/*.d.ts",
|
||||
"../../test/list.test.ts"
|
||||
],
|
||||
"exclude": ["**/*.test.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user