浏览代码

fix: fetch llm list by @tanstack/react-query #1306 (#1708)

### What problem does this PR solve?

fix: fetch llm list by @tanstack/react-query #1306

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.9.0
balibabu 1年前
父节点
当前提交
375f621405
没有帐户链接到提交者的电子邮件

+ 134
- 117
web/src/hooks/llm-hooks.ts 查看文件

import { LlmModelType } from '@/constants/knowledge'; import { LlmModelType } from '@/constants/knowledge';
import { ResponseGetType } from '@/interfaces/database/base';
import { import {
IFactory, IFactory,
IMyLlmValue, IMyLlmValue,
IThirdOAIModelCollection as IThirdAiModelCollection,
IThirdOAIModelCollection, IThirdOAIModelCollection,
} from '@/interfaces/database/llm'; } from '@/interfaces/database/llm';
import { import {
IAddLlmRequestBody, IAddLlmRequestBody,
IDeleteLlmRequestBody, IDeleteLlmRequestBody,
} from '@/interfaces/request/llm'; } from '@/interfaces/request/llm';
import userService from '@/services/user-service';
import { sortLLmFactoryListBySpecifiedOrder } from '@/utils/common-util'; import { sortLLmFactoryListBySpecifiedOrder } from '@/utils/common-util';
import { useCallback, useEffect, useMemo } from 'react';
import { useDispatch, useSelector } from 'umi';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { message } from 'antd';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'umi';


export const useFetchLlmList = ( export const useFetchLlmList = (
modelType?: LlmModelType, modelType?: LlmModelType,
isOnMountFetching: boolean = true,
) => {
const dispatch = useDispatch();

const fetchLlmList = useCallback(() => {
dispatch({
type: 'settingModel/llm_list',
payload: { model_type: modelType },
});
}, [dispatch, modelType]);

useEffect(() => {
if (isOnMountFetching) {
fetchLlmList();
}
}, [fetchLlmList, isOnMountFetching]);
): IThirdAiModelCollection => {
const { data } = useQuery({
queryKey: ['llmList'],
initialData: {},
queryFn: async () => {
const { data } = await userService.llm_list({ model_type: modelType });

return data?.data ?? {};
},
});


return fetchLlmList;
return data;
}; };


export const useSelectLlmInfo = () => { export const useSelectLlmInfo = () => {
}; };


export const useSelectLlmOptions = () => { export const useSelectLlmOptions = () => {
const llmInfo: IThirdOAIModelCollection = useSelectLlmInfo();
const llmInfo: IThirdOAIModelCollection = useFetchLlmList();


const embeddingModelOptions = useMemo(() => { const embeddingModelOptions = useMemo(() => {
return Object.entries(llmInfo).map(([key, value]) => { return Object.entries(llmInfo).map(([key, value]) => {
}; };


export const useSelectLlmOptionsByModelType = () => { export const useSelectLlmOptionsByModelType = () => {
const llmInfo: IThirdOAIModelCollection = useSelectLlmInfo();
const llmInfo: IThirdOAIModelCollection = useFetchLlmList();


const groupOptionsByModelType = (modelType: LlmModelType) => { const groupOptionsByModelType = (modelType: LlmModelType) => {
return Object.entries(llmInfo) return Object.entries(llmInfo)
}; };
}; };


export const useSelectLlmFactoryList = () => {
const factoryList: IFactory[] = useSelector(
(state: any) => state.settingModel.factoryList,
);
return factoryList;
};
export const useFetchLlmFactoryList = (): ResponseGetType<IFactory[]> => {
const { data, isFetching: loading } = useQuery({
queryKey: ['factoryList'],
initialData: [],
gcTime: 0,
queryFn: async () => {
const { data } = await userService.factories_list();


export const useSelectMyLlmList = () => {
const myLlmList: Record<string, IMyLlmValue> = useSelector(
(state: any) => state.settingModel.myLlmList,
);
return data?.data ?? [];
},
});


return myLlmList;
return { data, loading };
}; };


export const useFetchLlmFactoryListOnMount = () => {
const dispatch = useDispatch();
const factoryList = useSelectLlmFactoryList();
const myLlmList = useSelectMyLlmList();

const list = useMemo(() => {
const currentList = factoryList.filter((x) =>
Object.keys(myLlmList).every((y) => y !== x.name),
);
return sortLLmFactoryListBySpecifiedOrder(currentList);
}, [factoryList, myLlmList]);

const fetchLlmFactoryList = useCallback(() => {
dispatch({
type: 'settingModel/factories_list',
});
}, [dispatch]);
export type LlmItem = { name: string; logo: string } & IMyLlmValue;


useEffect(() => {
fetchLlmFactoryList();
}, [fetchLlmFactoryList]);
export const useFetchMyLlmList = (): ResponseGetType<
Record<string, IMyLlmValue>
> => {
const { data, isFetching: loading } = useQuery({
queryKey: ['myLlmList'],
initialData: {},
gcTime: 0,
queryFn: async () => {
const { data } = await userService.my_llm();

return data?.data ?? {};
},
});


return list;
return { data, loading };
}; };


export type LlmItem = { name: string; logo: string } & IMyLlmValue;
export const useSelectLlmList = () => {
const { data: myLlmList, loading: myLlmListLoading } = useFetchMyLlmList();
const { data: factoryList, loading: factoryListLoading } =
useFetchLlmFactoryList();


export const useFetchMyLlmListOnMount = () => {
const dispatch = useDispatch();
const llmList = useSelectMyLlmList();
const factoryList = useSelectLlmFactoryList();

const list: Array<LlmItem> = useMemo(() => {
return Object.entries(llmList).map(([key, value]) => ({
const nextMyLlmList: Array<LlmItem> = useMemo(() => {
return Object.entries(myLlmList).map(([key, value]) => ({
name: key, name: key,
logo: factoryList.find((x) => x.name === key)?.logo ?? '', logo: factoryList.find((x) => x.name === key)?.logo ?? '',
...value, ...value,
})); }));
}, [llmList, factoryList]);
}, [myLlmList, factoryList]);


const fetchMyLlmList = useCallback(() => {
dispatch({
type: 'settingModel/my_llm',
});
}, [dispatch]);

useEffect(() => {
fetchMyLlmList();
}, [fetchMyLlmList]);
const nextFactoryList = useMemo(() => {
const currentList = factoryList.filter((x) =>
Object.keys(myLlmList).every((y) => y !== x.name),
);
return sortLLmFactoryListBySpecifiedOrder(currentList);
}, [factoryList, myLlmList]);


return list;
return {
myLlmList: nextMyLlmList,
factoryList: nextFactoryList,
loading: myLlmListLoading || factoryListLoading,
};
}; };


export interface IApiKeySavingParams { export interface IApiKeySavingParams {
} }


export const useSaveApiKey = () => { export const useSaveApiKey = () => {
const dispatch = useDispatch();

const saveApiKey = useCallback(
(savingParams: IApiKeySavingParams) => {
return dispatch<any>({
type: 'settingModel/set_api_key',
payload: savingParams,
});
const queryClient = useQueryClient();
const { t } = useTranslation();
const {
data,
isPending: loading,
mutateAsync,
} = useMutation({
mutationKey: ['saveApiKey'],
mutationFn: async (params: IApiKeySavingParams) => {
const { data } = await userService.set_api_key(params);
if (data.retcode === 0) {
message.success(t('message.modified'));
queryClient.invalidateQueries({ queryKey: ['myLlmList'] });
queryClient.invalidateQueries({ queryKey: ['factoryList'] });
}
return data.retcode;
}, },
[dispatch],
);
});


return saveApiKey;
return { data, loading, saveApiKey: mutateAsync };
}; };


export interface ISystemModelSettingSavingParams { export interface ISystemModelSettingSavingParams {
} }


export const useSaveTenantInfo = () => { export const useSaveTenantInfo = () => {
const dispatch = useDispatch();

const saveTenantInfo = useCallback(
(savingParams: ISystemModelSettingSavingParams) => {
return dispatch<any>({
type: 'settingModel/set_tenant_info',
payload: savingParams,
});
const { t } = useTranslation();
const {
data,
isPending: loading,
mutateAsync,
} = useMutation({
mutationKey: ['saveTenantInfo'],
mutationFn: async (params: ISystemModelSettingSavingParams) => {
const { data } = await userService.set_tenant_info(params);
if (data.retcode === 0) {
message.success(t('message.modified'));
}
return data.retcode;
}, },
[dispatch],
);
});


return saveTenantInfo;
return { data, loading, saveTenantInfo: mutateAsync };
}; };


export const useAddLlm = () => { export const useAddLlm = () => {
const dispatch = useDispatch();

const addLlm = useCallback(
(requestBody: IAddLlmRequestBody) => {
return dispatch<any>({
type: 'settingModel/add_llm',
payload: requestBody,
});
const queryClient = useQueryClient();
const { t } = useTranslation();
const {
data,
isPending: loading,
mutateAsync,
} = useMutation({
mutationKey: ['addLlm'],
mutationFn: async (params: IAddLlmRequestBody) => {
const { data } = await userService.add_llm(params);
if (data.retcode === 0) {
queryClient.invalidateQueries({ queryKey: ['myLlmList'] });
queryClient.invalidateQueries({ queryKey: ['factoryList'] });
message.success(t('message.modified'));
}
return data.retcode;
}, },
[dispatch],
);
});


return addLlm;
return { data, loading, addLlm: mutateAsync };
}; };


export const useDeleteLlm = () => { export const useDeleteLlm = () => {
const dispatch = useDispatch();

const deleteLlm = useCallback(
(requestBody: IDeleteLlmRequestBody) => {
return dispatch<any>({
type: 'settingModel/delete_llm',
payload: requestBody,
});
const queryClient = useQueryClient();
const { t } = useTranslation();
const {
data,
isPending: loading,
mutateAsync,
} = useMutation({
mutationKey: ['deleteLlm'],
mutationFn: async (params: IDeleteLlmRequestBody) => {
const { data } = await userService.delete_llm(params);
if (data.retcode === 0) {
queryClient.invalidateQueries({ queryKey: ['myLlmList'] });
queryClient.invalidateQueries({ queryKey: ['factoryList'] });
message.success(t('message.deleted'));
}
return data.retcode;
}, },
[dispatch],
);
});


return deleteLlm;
return { data, loading, deleteLlm: mutateAsync };
}; };

+ 0
- 11
web/src/hooks/logic-hooks.ts 查看文件

import { useDispatch } from 'umi'; import { useDispatch } from 'umi';
import { useSetModalState, useTranslate } from './common-hooks'; import { useSetModalState, useTranslate } from './common-hooks';
import { useSetDocumentParser } from './document-hooks'; import { useSetDocumentParser } from './document-hooks';
import { useFetchLlmList } from './llm-hooks';
import { useSetPaginationParams } from './route-hook'; import { useSetPaginationParams } from './route-hook';
import { useOneNamespaceEffectsLoading } from './store-hooks'; import { useOneNamespaceEffectsLoading } from './store-hooks';
import { import {


return tenantInfo?.llm_id ?? ''; return tenantInfo?.llm_id ?? '';
}; };

export const useFetchLlmModelOnVisible = (visible: boolean) => {
const fetchLlmList = useFetchLlmList();

useEffect(() => {
if (visible) {
fetchLlmList();
}
}, [fetchLlmList, visible]);
};

+ 5
- 0
web/src/interfaces/database/base.ts 查看文件

retmsg: string; retmsg: string;
status: number; status: number;
} }

export interface ResponseGetType<T = any> {
data: T;
loading?: boolean;
}

+ 1
- 3
web/src/pages/add-knowledge/components/knowledge-setting/hooks.ts 查看文件

useFetchKnowledgeBaseConfiguration, useFetchKnowledgeBaseConfiguration,
useUpdateKnowledge, useUpdateKnowledge,
} from '@/hooks/knowledge-hooks'; } from '@/hooks/knowledge-hooks';
import { useFetchLlmList, useSelectLlmOptions } from '@/hooks/llm-hooks';
import { useSelectLlmOptions } from '@/hooks/llm-hooks';
import { useNavigateToDataset } from '@/hooks/route-hook'; import { useNavigateToDataset } from '@/hooks/route-hook';
import { import {
useFetchTenantInfo, useFetchTenantInfo,
import { FormInstance } from 'antd/lib'; import { FormInstance } from 'antd/lib';
import pick from 'lodash/pick'; import pick from 'lodash/pick';
import { useCallback, useEffect } from 'react'; import { useCallback, useEffect } from 'react';
import { LlmModelType } from '../../constant';


export const useSubmitKnowledgeConfiguration = (form: FormInstance) => { export const useSubmitKnowledgeConfiguration = (form: FormInstance) => {
const { saveKnowledgeConfiguration, loading } = useUpdateKnowledge(); const { saveKnowledgeConfiguration, loading } = useUpdateKnowledge();


useFetchTenantInfo(); useFetchTenantInfo();
const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration(); const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration();
useFetchLlmList(LlmModelType.Embedding);


useEffect(() => { useEffect(() => {
const fileList: UploadFile[] = getUploadFileListFromBase64( const fileList: UploadFile[] = getUploadFileListFromBase64(

+ 3
- 10
web/src/pages/add-knowledge/components/knowledge-testing/testing-control/index.tsx 查看文件

import Rerank from '@/components/rerank';
import SimilaritySlider from '@/components/similarity-slider'; import SimilaritySlider from '@/components/similarity-slider';
import { useTranslate } from '@/hooks/common-hooks';
import { useOneNamespaceEffectsLoading } from '@/hooks/store-hooks';
import { Button, Card, Divider, Flex, Form, Input } from 'antd'; import { Button, Card, Divider, Flex, Form, Input } from 'antd';
import { FormInstance } from 'antd/lib'; import { FormInstance } from 'antd/lib';


import Rerank from '@/components/rerank';
import { useTranslate } from '@/hooks/common-hooks';
import { useFetchLlmList } from '@/hooks/llm-hooks';
import { useOneNamespaceEffectsLoading } from '@/hooks/store-hooks';
import { useEffect } from 'react';
import styles from './index.less'; import styles from './index.less';


type FieldType = { type FieldType = {
'testDocumentChunk', 'testDocumentChunk',
]); ]);
const { t } = useTranslate('knowledgeDetails'); const { t } = useTranslate('knowledgeDetails');
const fetchLlmList = useFetchLlmList();

useEffect(() => {
fetchLlmList();
}, [fetchLlmList]);


const buttonDisabled = const buttonDisabled =
!question || (typeof question === 'string' && question.trim() === ''); !question || (typeof question === 'string' && question.trim() === '');

+ 5
- 14
web/src/pages/chat/chat-configuration-modal/index.tsx 查看文件

ModelVariableType, ModelVariableType,
settledModelVariableMap, settledModelVariableMap,
} from '@/constants/knowledge'; } from '@/constants/knowledge';
import { useTranslate } from '@/hooks/common-hooks';
import { useFetchModelId } from '@/hooks/logic-hooks';
import { IDialog } from '@/interfaces/database/chat'; import { IDialog } from '@/interfaces/database/chat';
import { getBase64FromUploadFileList } from '@/utils/file-util';
import { removeUselessFieldsFromValues } from '@/utils/form';
import { Divider, Flex, Form, Modal, Segmented, UploadFile } from 'antd'; import { Divider, Flex, Form, Modal, Segmented, UploadFile } from 'antd';
import { SegmentedValue } from 'antd/es/segmented'; import { SegmentedValue } from 'antd/es/segmented';
import camelCase from 'lodash/camelCase'; import camelCase from 'lodash/camelCase';
import ModelSetting from './model-setting'; import ModelSetting from './model-setting';
import PromptEngine from './prompt-engine'; import PromptEngine from './prompt-engine';


import { useTranslate } from '@/hooks/common-hooks';
import {
useFetchLlmModelOnVisible,
useFetchModelId,
} from '@/hooks/logic-hooks';
import { getBase64FromUploadFileList } from '@/utils/file-util';
import { removeUselessFieldsFromValues } from '@/utils/form';
import styles from './index.less'; import styles from './index.less';


const layout = { const layout = {
onOk(finalValues); onOk(finalValues);
}; };


const handleCancel = () => {
hideModal();
};

const handleSegmentedChange = (val: SegmentedValue) => { const handleSegmentedChange = (val: SegmentedValue) => {
setValue(val as ConfigurationSegmented); setValue(val as ConfigurationSegmented);
}; };
form.resetFields(); form.resetFields();
}; };


useFetchLlmModelOnVisible(visible);

const title = ( const title = (
<Flex gap={16}> <Flex gap={16}>
<ChatConfigurationAtom></ChatConfigurationAtom> <ChatConfigurationAtom></ChatConfigurationAtom>
width={688} width={688}
open={visible} open={visible}
onOk={handleOk} onOk={handleOk}
onCancel={handleCancel}
onCancel={hideModal}
confirmLoading={loading} confirmLoading={loading}
destroyOnClose destroyOnClose
afterClose={handleModalAfterClose} afterClose={handleModalAfterClose}

+ 11
- 9
web/src/pages/chat/index.tsx 查看文件

</Flex> </Flex>
<Divider type={'vertical'} className={styles.divider}></Divider> <Divider type={'vertical'} className={styles.divider}></Divider>
<ChatContainer></ChatContainer> <ChatContainer></ChatContainer>
<ChatConfigurationModal
visible={dialogEditVisible}
initialDialog={initialDialog}
showModal={showDialogEditModal}
hideModal={hideDialogEditModal}
loading={dialogSettingLoading}
onOk={onDialogEditOk}
clearDialog={clearDialog}
></ChatConfigurationModal>
{dialogEditVisible && (
<ChatConfigurationModal
visible={dialogEditVisible}
initialDialog={initialDialog}
showModal={showDialogEditModal}
hideModal={hideDialogEditModal}
loading={dialogSettingLoading}
onOk={onDialogEditOk}
clearDialog={clearDialog}
></ChatConfigurationModal>
)}
<RenameModal <RenameModal
visible={conversationRenameVisible} visible={conversationRenameVisible}
hideModal={hideConversationRenameModal} hideModal={hideConversationRenameModal}

+ 0
- 3
web/src/pages/flow/hooks.ts 查看文件

import { useSetModalState } from '@/hooks/common-hooks'; import { useSetModalState } from '@/hooks/common-hooks';
import { useFetchFlow, useResetFlow, useSetFlow } from '@/hooks/flow-hooks'; import { useFetchFlow, useResetFlow, useSetFlow } from '@/hooks/flow-hooks';
import { useFetchLlmList } from '@/hooks/llm-hooks';
import { IGraph } from '@/interfaces/database/flow'; import { IGraph } from '@/interfaces/database/flow';
import { useIsFetching } from '@tanstack/react-query'; import { useIsFetching } from '@tanstack/react-query';
import React, { import React, {


useWatchGraphChange(); useWatchGraphChange();


useFetchLlmList();

useEffect(() => { useEffect(() => {
refetch(); refetch();
}, [refetch]); }, [refetch]);

+ 8
- 30
web/src/pages/user-setting/setting-model/hooks.ts 查看文件

ISystemModelSettingSavingParams, ISystemModelSettingSavingParams,
useAddLlm, useAddLlm,
useDeleteLlm, useDeleteLlm,
useFetchLlmList,
useSaveApiKey, useSaveApiKey,
useSaveTenantInfo, useSaveTenantInfo,
useSelectLlmOptionsByModelType, useSelectLlmOptionsByModelType,
} from '@/hooks/llm-hooks'; } from '@/hooks/llm-hooks';
import { useOneNamespaceEffectsLoading } from '@/hooks/store-hooks';
import { import {
useFetchTenantInfo, useFetchTenantInfo,
useSelectTenantInfo, useSelectTenantInfo,
const [savingParams, setSavingParams] = useState<SavingParamsState>( const [savingParams, setSavingParams] = useState<SavingParamsState>(
{} as SavingParamsState, {} as SavingParamsState,
); );
const saveApiKey = useSaveApiKey();
const { saveApiKey, loading } = useSaveApiKey();
const { const {
visible: apiKeyVisible, visible: apiKeyVisible,
hideModal: hideApiKeyModal, hideModal: hideApiKeyModal,
[showApiKeyModal, setSavingParams], [showApiKeyModal, setSavingParams],
); );


const loading = useOneNamespaceEffectsLoading('settingModel', [
'set_api_key',
]);

return { return {
saveApiKeyLoading: loading, saveApiKeyLoading: loading,
initialApiKey: '', initialApiKey: '',


export const useSubmitSystemModelSetting = () => { export const useSubmitSystemModelSetting = () => {
const systemSetting = useSelectTenantInfo(); const systemSetting = useSelectTenantInfo();
const loading = useOneNamespaceEffectsLoading('settingModel', [
'set_tenant_info',
]);
const saveSystemModelSetting = useSaveTenantInfo();
const { saveTenantInfo: saveSystemModelSetting, loading } =
useSaveTenantInfo();
const { const {
visible: systemSettingVisible, visible: systemSettingVisible,
hideModal: hideSystemSettingModal, hideModal: hideSystemSettingModal,
export const useFetchSystemModelSettingOnMount = (visible: boolean) => { export const useFetchSystemModelSettingOnMount = (visible: boolean) => {
const systemSetting = useSelectTenantInfo(); const systemSetting = useSelectTenantInfo();
const allOptions = useSelectLlmOptionsByModelType(); const allOptions = useSelectLlmOptionsByModelType();
const fetchLlmList = useFetchLlmList();
const fetchTenantInfo = useFetchTenantInfo(); const fetchTenantInfo = useFetchTenantInfo();


useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
fetchLlmList();
fetchTenantInfo(); fetchTenantInfo();
} }
}, [fetchLlmList, fetchTenantInfo, visible]);
}, [fetchTenantInfo, visible]);


return { systemSetting, allOptions }; return { systemSetting, allOptions };
}; };


export const useSelectModelProvidersLoading = () => {
const loading = useOneNamespaceEffectsLoading('settingModel', [
'my_llm',
'factories_list',
]);

return loading;
};

export const useSubmitOllama = () => { export const useSubmitOllama = () => {
const loading = useOneNamespaceEffectsLoading('settingModel', ['add_llm']);
const [selectedLlmFactory, setSelectedLlmFactory] = useState<string>(''); const [selectedLlmFactory, setSelectedLlmFactory] = useState<string>('');
const addLlm = useAddLlm();
const { addLlm, loading } = useAddLlm();
const { const {
visible: llmAddingVisible, visible: llmAddingVisible,
hideModal: hideLlmAddingModal, hideModal: hideLlmAddingModal,
}; };


export const useSubmitVolcEngine = () => { export const useSubmitVolcEngine = () => {
const loading = useOneNamespaceEffectsLoading('settingModel', ['add_llm']);
const addLlm = useAddLlm();
const { addLlm, loading } = useAddLlm();
const { const {
visible: volcAddingVisible, visible: volcAddingVisible,
hideModal: hideVolcAddingModal, hideModal: hideVolcAddingModal,
}; };


export const useSubmitBedrock = () => { export const useSubmitBedrock = () => {
const loading = useOneNamespaceEffectsLoading('settingModel', ['add_llm']);
const addLlm = useAddLlm();
const { addLlm, loading } = useAddLlm();
const { const {
visible: bedrockAddingVisible, visible: bedrockAddingVisible,
hideModal: hideBedrockAddingModal, hideModal: hideBedrockAddingModal,
}; };


export const useHandleDeleteLlm = (llmFactory: string) => { export const useHandleDeleteLlm = (llmFactory: string) => {
const deleteLlm = useDeleteLlm();
const { deleteLlm } = useDeleteLlm();
const showDeleteConfirm = useShowDeleteConfirm(); const showDeleteConfirm = useShowDeleteConfirm();


const handleDeleteLlm = (name: string) => () => { const handleDeleteLlm = (name: string) => () => {

+ 2
- 9
web/src/pages/user-setting/setting-model/index.tsx 查看文件

import { ReactComponent as MoreModelIcon } from '@/assets/svg/more-model.svg'; import { ReactComponent as MoreModelIcon } from '@/assets/svg/more-model.svg';
import SvgIcon from '@/components/svg-icon'; import SvgIcon from '@/components/svg-icon';
import { useSetModalState, useTranslate } from '@/hooks/common-hooks'; import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
import {
LlmItem,
useFetchLlmFactoryListOnMount,
useFetchMyLlmListOnMount,
} from '@/hooks/llm-hooks';
import { LlmItem, useSelectLlmList } from '@/hooks/llm-hooks';
import { import {
CloseCircleOutlined, CloseCircleOutlined,
SettingOutlined, SettingOutlined,
import { IconMap } from './constant'; import { IconMap } from './constant';
import { import {
useHandleDeleteLlm, useHandleDeleteLlm,
useSelectModelProvidersLoading,
useSubmitApiKey, useSubmitApiKey,
useSubmitBedrock, useSubmitBedrock,
useSubmitOllama, useSubmitOllama,
}; };


const UserSettingModel = () => { const UserSettingModel = () => {
const factoryList = useFetchLlmFactoryListOnMount();
const llmList = useFetchMyLlmListOnMount();
const loading = useSelectModelProvidersLoading();
const { factoryList, myLlmList: llmList, loading } = useSelectLlmList();
const { const {
saveApiKeyLoading, saveApiKeyLoading,
initialApiKey, initialApiKey,

正在加载...
取消
保存