mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-19 03:56:42 +08:00
### What problem does this PR solve? feat: Delete Model Provider #2376 ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -3,6 +3,7 @@ import {
|
||||
IApiKeySavingParams,
|
||||
ISystemModelSettingSavingParams,
|
||||
useAddLlm,
|
||||
useDeleteFactory,
|
||||
useDeleteLlm,
|
||||
useSaveApiKey,
|
||||
useSaveTenantInfo,
|
||||
@ -366,3 +367,18 @@ export const useHandleDeleteLlm = (llmFactory: string) => {
|
||||
|
||||
return { handleDeleteLlm };
|
||||
};
|
||||
|
||||
export const useHandleDeleteFactory = (llmFactory: string) => {
|
||||
const { deleteFactory } = useDeleteFactory();
|
||||
const showDeleteConfirm = useShowDeleteConfirm();
|
||||
|
||||
const handleDeleteFactory = () => {
|
||||
showDeleteConfirm({
|
||||
onOk: async () => {
|
||||
deleteFactory({ llm_factory: llmFactory });
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return { handleDeleteFactory };
|
||||
};
|
||||
|
||||
@ -34,6 +34,7 @@ import { IconMap } from './constant';
|
||||
import FishAudioModal from './fish-audio-modal';
|
||||
import GoogleModal from './google-modal';
|
||||
import {
|
||||
useHandleDeleteFactory,
|
||||
useHandleDeleteLlm,
|
||||
useSubmitApiKey,
|
||||
useSubmitBedrock,
|
||||
@ -75,6 +76,7 @@ const ModelCard = ({ item, clickApiKey }: IModelCardProps) => {
|
||||
const { visible, switchVisible } = useSetModalState();
|
||||
const { t } = useTranslate('setting');
|
||||
const { handleDeleteLlm } = useHandleDeleteLlm(item.name);
|
||||
const { handleDeleteFactory } = useHandleDeleteFactory(item.name);
|
||||
|
||||
const handleApiKeyClick = () => {
|
||||
clickApiKey(item.name);
|
||||
@ -118,6 +120,9 @@ const ModelCard = ({ item, clickApiKey }: IModelCardProps) => {
|
||||
<MoreModelIcon />
|
||||
</Flex>
|
||||
</Button>
|
||||
<Button type={'text'} onClick={handleDeleteFactory}>
|
||||
<CloseCircleOutlined style={{ color: '#D92D20' }} />
|
||||
</Button>
|
||||
</Space>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
Reference in New Issue
Block a user