chore: providers ux
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { PageActionType } from '@/config/types';
|
||||
import { createContext, useContext } from 'react';
|
||||
|
||||
interface FormContextProps {
|
||||
providerType?: string;
|
||||
action?: PageActionType;
|
||||
}
|
||||
|
||||
const FormContext = createContext<FormContextProps>({});
|
||||
|
||||
export const useFormContext = () => {
|
||||
const context = useContext(FormContext);
|
||||
if (!context) {
|
||||
throw new Error('useFormContext must be used within a FormProvider');
|
||||
}
|
||||
return context;
|
||||
};
|
||||
|
||||
export default FormContext;
|
||||
@@ -44,8 +44,8 @@ export const maasProviderOptions = Object.entries(maasProviderValueMap).map(
|
||||
);
|
||||
|
||||
export const ProviderStatusValueMap: Record<string, string> = {
|
||||
Ready: 'Ready',
|
||||
InActive: 'Inactive'
|
||||
Ready: 'ready',
|
||||
InActive: 'inactive'
|
||||
};
|
||||
|
||||
export const ProviderStatusLabelMap = {
|
||||
@@ -65,6 +65,11 @@ export const rowActionList = [
|
||||
label: 'common.button.edit',
|
||||
icon: icons.EditOutlined
|
||||
},
|
||||
{
|
||||
key: 'copy',
|
||||
label: 'common.button.copy',
|
||||
icon: icons.CopyOutlined
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
label: 'common.button.delete',
|
||||
|
||||
@@ -9,23 +9,26 @@ export const mockDataList: MaasProviderItem[] = [
|
||||
models: 5,
|
||||
state_message: '',
|
||||
provider: 'doubao',
|
||||
proxy_config: {},
|
||||
builtIn: false
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
models: 3,
|
||||
name: 'Qwen',
|
||||
state: 'Inactive',
|
||||
state: 'inactive',
|
||||
state_message: 'Provider is inactive',
|
||||
provider: 'qwen',
|
||||
proxy_config: false,
|
||||
builtIn: true
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
models: 8,
|
||||
name: 'OpenAI',
|
||||
state: 'Ready',
|
||||
state: 'ready',
|
||||
state_message: '',
|
||||
proxy_config: null,
|
||||
provider: 'openai',
|
||||
builtIn: false
|
||||
},
|
||||
@@ -33,18 +36,20 @@ export const mockDataList: MaasProviderItem[] = [
|
||||
id: 4,
|
||||
models: 2,
|
||||
name: 'Deepseek',
|
||||
state: 'Ready',
|
||||
state: 'ready',
|
||||
state_message: '',
|
||||
provider: 'deepseek',
|
||||
proxy_config: null,
|
||||
builtIn: false
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
models: 4,
|
||||
name: 'Anthropic',
|
||||
state: 'Inactive',
|
||||
state: 'inactive',
|
||||
state_message: 'Provider is inactive',
|
||||
provider: 'anthropic',
|
||||
proxy_config: {},
|
||||
builtIn: true
|
||||
}
|
||||
];
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface MaasProviderItem {
|
||||
state: string;
|
||||
state_message: string;
|
||||
provider: maasProviderType;
|
||||
proxy_config?: any;
|
||||
builtIn: boolean;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user