chore: check compatibility ux
This commit is contained in:
@@ -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;
|
||||
};
|
||||
@@ -177,14 +177,22 @@ export const AudioModeTypeMap = {
|
||||
Whisper: ['Whisper', 'whisper'],
|
||||
CosyVoice: ['CosyVoice', 'cosyvoice', 'cosy-voice', 'cosy_voice']
|
||||
};
|
||||
interface ModelSource {
|
||||
huggingface: string;
|
||||
huggingface_value: string;
|
||||
ollama_library: string;
|
||||
ollama_library_value: string;
|
||||
modelScope: string;
|
||||
modelscope_value: string;
|
||||
local_path: string;
|
||||
local_path_value: string;
|
||||
}
|
||||
|
||||
export const modelSourceMap: Record<string, string> = {
|
||||
export const modelSourceMap: ModelSource = {
|
||||
huggingface: 'Hugging Face',
|
||||
ollama_library: 'Ollama Library',
|
||||
s3: 'S3',
|
||||
huggingface_value: 'huggingface',
|
||||
ollama_library: 'Ollama Library',
|
||||
ollama_library_value: 'ollama_library',
|
||||
s3_value: 's3',
|
||||
modelScope: 'ModelScope',
|
||||
modelscope_value: 'model_scope',
|
||||
local_path: 'Local Path',
|
||||
@@ -194,7 +202,6 @@ export const modelSourceMap: Record<string, string> = {
|
||||
export const modelSourceValueMap = {
|
||||
[modelSourceMap.huggingface_value]: modelSourceMap.huggingface,
|
||||
[modelSourceMap.ollama_library_value]: modelSourceMap.ollama_library,
|
||||
[modelSourceMap.s3_value]: modelSourceMap.s3,
|
||||
[modelSourceMap.modelscope_value]: modelSourceMap.modelScope,
|
||||
[modelSourceMap.local_path_value]: modelSourceMap.local_path
|
||||
};
|
||||
@@ -459,5 +466,7 @@ export const excludeFields = [
|
||||
'name',
|
||||
'description',
|
||||
'env',
|
||||
'source'
|
||||
'source',
|
||||
'quantization',
|
||||
'size'
|
||||
];
|
||||
|
||||
@@ -29,6 +29,12 @@ export interface ListItem {
|
||||
worker_selector?: object;
|
||||
}
|
||||
|
||||
export type SourceType =
|
||||
| 'huggingface'
|
||||
| 'model_scope'
|
||||
| 'local_path'
|
||||
| 'ollama_library';
|
||||
|
||||
export interface FormData {
|
||||
backend: string;
|
||||
env?: Record<string, any>;
|
||||
|
||||
Reference in New Issue
Block a user