feat: Delete Model Provider #2376 (#2565)

### 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:
balibabu
2024-09-24 19:10:06 +08:00
committed by GitHub
parent 91dbce30bd
commit 9251fb39af
6 changed files with 51 additions and 1 deletions

View File

@ -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 };
};

View File

@ -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>