feat: delete the added model #503 and display an error message when the requested file fails to parse #684 (#708)

### What problem does this PR solve?

feat: delete the added model #503
feat: display an error message when the requested file fails to parse
#684

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-05-10 10:38:39 +08:00
committed by GitHub
parent bef1bbdf3e
commit d65ba3e4d7
28 changed files with 720 additions and 1738 deletions

View File

@ -4,7 +4,10 @@ import {
IMyLlmValue,
IThirdOAIModelCollection,
} from '@/interfaces/database/llm';
import { IAddLlmRequestBody } from '@/interfaces/request/llm';
import {
IAddLlmRequestBody,
IDeleteLlmRequestBody,
} from '@/interfaces/request/llm';
import { sortLLmFactoryListBySpecifiedOrder } from '@/utils/commonUtil';
import { useCallback, useEffect, useMemo } from 'react';
import { useDispatch, useSelector } from 'umi';
@ -211,7 +214,7 @@ export const useSaveTenantInfo = () => {
export const useAddLlm = () => {
const dispatch = useDispatch();
const saveTenantInfo = useCallback(
const addLlm = useCallback(
(requestBody: IAddLlmRequestBody) => {
return dispatch<any>({
type: 'settingModel/add_llm',
@ -221,5 +224,21 @@ export const useAddLlm = () => {
[dispatch],
);
return saveTenantInfo;
return addLlm;
};
export const useDeleteLlm = () => {
const dispatch = useDispatch();
const deleteLlm = useCallback(
(requestBody: IDeleteLlmRequestBody) => {
return dispatch<any>({
type: 'settingModel/delete_llm',
payload: requestBody,
});
},
[dispatch],
);
return deleteLlm;
};