chore: check compatibility ux

This commit is contained in:
jialin
2025-03-31 16:21:40 +08:00
parent bd6c689d91
commit f83e49bd3d
30 changed files with 1192 additions and 583 deletions
+41
View File
@@ -0,0 +1,41 @@
import React from 'react';
interface FormContextProps {
isGGUF: boolean;
byBuiltIn?: boolean;
sizeOptions?: Global.BaseOption<number>[];
quantizationOptions?: Global.BaseOption<string>[];
modelFileOptions?: any[];
onSizeChange?: (val: number) => void;
onQuantizationChange?: (val: string) => void;
}
interface FormInnerContextProps {
onBackendChange?: (backend: string) => void;
}
export const FormContext = React.createContext<FormContextProps>(
{} as FormContextProps
);
export const FormInnerContext = React.createContext<FormInnerContextProps>(
{} as FormInnerContextProps
);
export const useFormContext = () => {
const context = React.useContext(FormContext);
if (!context) {
throw new Error('useFormContext must be used within a FormProvider');
}
return context;
};
export const useFormInnerContext = () => {
const context = React.useContext(FormInnerContext);
if (!context) {
throw new Error(
'useFormInnerContext must be used within a FormInnerProvider'
);
}
return context;
};