import PluginExtraFields from '@/components/plugin-extra-fields'; import { PageAction } from '@/config'; import { Input as CInput, Password, Select as SealSelect, useAppUtils } from '@gpustack/core-ui'; import { useIntl } from '@umijs/max'; import { Form } from 'antd'; import ProviderLogo from '../components/provider-logo'; import { useFormContext } from '../config/form-context'; import { maasProviderOptions } from '../config/providers'; import { FormData } from '../config/types'; import providerTypeStyles from '../styles/provider-type.less'; import ProviderConfigs from './provider-configs'; const Basic: React.FC<{ onAPIKeyBlur?: (e: any) => void; }> = ({ onAPIKeyBlur }) => { const intl = useIntl(); const form = Form.useFormInstance(); const { action } = useFormContext(); const providerType = Form.useWatch(['config', 'type'], form); const { getRuleMessage } = useAppUtils(); const optionRender = (option: any) => { return (
{option.label}
); }; const filterOption = (input: string, option?: any) => { return ( option?.label?.toLowerCase().includes(input.toLowerCase()) || option?.value?.toLowerCase().includes(input.toLowerCase()) ); }; const renderLogoPrefix = () => { const hasProvider = maasProviderOptions.some( (option) => option.value === providerType ); if (hasProvider) { return (
); } return null; }; return ( <> name="name" data-field="name" required rules={[ { required: true, message: getRuleMessage('input', 'common.table.name') } ]} > name={['config', 'type']} rules={[ { required: true, message: getRuleMessage('select', 'common.table.type') } ]} > name="api_key" rules={[ { required: true, message: getRuleMessage('input', 'providers.form.tokens.title') } ]} > name="description"> ); }; export default Basic;