Fix variable typo (#8084)

This commit is contained in:
Nam Vu 2024-09-08 12:14:11 +07:00 • committed by GitHub
commit 2d7954c7da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
215 changed files with 599 additions and 597 deletions

View file

@ -35,9 +35,9 @@ const ModelProviderPage = () => {
const { modelProviders: providers } = useProviderContext()
const setShowModelModal = useModalContextSelector(state => state.setShowModelModal)
const defaultModelNotConfigured = !textGenerationDefaultModel && !embeddingsDefaultModel && !speech2textDefaultModel && !rerankDefaultModel && !ttsDefaultModel
const [configedProviders, notConfigedProviders] = useMemo(() => {
const configedProviders: ModelProvider[] = []
const notConfigedProviders: ModelProvider[] = []
const [configuredProviders, notConfiguredProviders] = useMemo(() => {
const configuredProviders: ModelProvider[] = []
const notConfiguredProviders: ModelProvider[] = []
providers.forEach((provider) => {
if (
@ -47,12 +47,12 @@ const ModelProviderPage = () => {
&& provider.system_configuration.quota_configurations.find(item => item.quota_type === provider.system_configuration.current_quota_type)
)
)
configedProviders.push(provider)
configuredProviders.push(provider)
else
notConfigedProviders.push(provider)
notConfiguredProviders.push(provider)
})
return [configedProviders, notConfigedProviders]
return [configuredProviders, notConfiguredProviders]
}, [providers])
const handleOpenModal = (
@ -110,10 +110,10 @@ const ModelProviderPage = () => {
/>
</div>
{
!!configedProviders?.length && (
!!configuredProviders?.length && (
<div className='pb-3'>
{
configedProviders?.map(provider => (
configuredProviders?.map(provider => (
<ProviderAddedCard
key={provider.provider}
provider={provider}
@ -125,7 +125,7 @@ const ModelProviderPage = () => {
)
}
{
!!notConfigedProviders?.length && (
!!notConfiguredProviders?.length && (
<>
<div className='flex items-center mb-2 text-xs font-semibold text-gray-500'>
+ {t('common.modelProvider.addMoreModelProvider')}
@ -133,7 +133,7 @@ const ModelProviderPage = () => {
</div>
<div className='grid grid-cols-3 gap-2'>
{
notConfigedProviders?.map(provider => (
notConfiguredProviders?.map(provider => (
<ProviderCard
key={provider.provider}
provider={provider}

View file

@ -91,7 +91,7 @@ const Form: FC<FormProps> = ({
if (show_on.length && !show_on.every(showOnItem => value[showOnItem.variable] === showOnItem.value))
return null
const disabed = readonly || (isEditMode && (variable === '__model_type' || variable === '__model_name'))
const disabled = readonly || (isEditMode && (variable === '__model_type' || variable === '__model_name'))
return (
<div key={variable} className={cn(itemClassName, 'py-3')}>
<div className={cn(fieldLabelClassName, 'flex items-center py-2 text-sm text-gray-900')}>
@ -104,12 +104,12 @@ const Form: FC<FormProps> = ({
{tooltipContent}
</div>
<Input
className={cn(inputClassName, `${disabed && 'cursor-not-allowed opacity-60'}`)}
className={cn(inputClassName, `${disabled && 'cursor-not-allowed opacity-60'}`)}
value={(isShowDefaultValue && ((value[variable] as string) === '' || value[variable] === undefined || value[variable] === null)) ? formSchema.default : value[variable]}
onChange={val => handleFormChange(variable, val)}
validated={validatedSuccess}
placeholder={placeholder?.[language] || placeholder?.en_US}
disabled={disabed}
disabled={disabled}
type={formSchema.type === FormTypeEnum.textNumber ? 'number' : 'text'}
{...(formSchema.type === FormTypeEnum.textNumber ? { min: (formSchema as CredentialFormSchemaNumberInput).min, max: (formSchema as CredentialFormSchemaNumberInput).max } : {})}
/>
@ -131,7 +131,7 @@ const Form: FC<FormProps> = ({
if (show_on.length && !show_on.every(showOnItem => value[showOnItem.variable] === showOnItem.value))
return null
const disabed = isEditMode && (variable === '__model_type' || variable === '__model_name')
const disabled = isEditMode && (variable === '__model_type' || variable === '__model_name')
return (
<div key={variable} className={cn(itemClassName, 'py-3')}>
@ -156,7 +156,7 @@ const Form: FC<FormProps> = ({
className={`
flex items-center px-3 py-2 rounded-lg border border-gray-100 bg-gray-25 cursor-pointer
${value[variable] === option.value && 'bg-white border-[1.5px] border-primary-400 shadow-sm'}
${disabed && '!cursor-not-allowed opacity-60'}
${disabled && '!cursor-not-allowed opacity-60'}
`}
onClick={() => handleFormChange(variable, option.value)}
key={`${variable}-${option.value}`}

View file

@ -36,7 +36,7 @@ const CredentialPanel: FC<CredentialPanelProps> = ({
const customConfig = provider.custom_configuration
const systemConfig = provider.system_configuration
const priorityUseType = provider.preferred_provider_type
const customConfiged = customConfig.status === CustomConfigurationStatusEnum.active
const isCustomConfigured = customConfig.status === CustomConfigurationStatusEnum.active
const configurateMethods = provider.configurate_methods
const handleChangePriority = async (key: PreferredProviderTypeEnum) => {
@ -69,7 +69,7 @@ const CredentialPanel: FC<CredentialPanelProps> = ({
<div className='shrink-0 relative ml-1 p-1 w-[112px] rounded-lg bg-white/[0.3] border-[0.5px] border-black/5'>
<div className='flex items-center justify-between mb-1 pt-1 pl-2 pr-[7px] h-5 text-xs font-medium text-gray-500'>
API-KEY
<Indicator color={customConfiged ? 'green' : 'gray'} />
<Indicator color={isCustomConfigured ? 'green' : 'gray'} />
</div>
<div className='flex items-center gap-0.5'>
<Button
@ -81,7 +81,7 @@ const CredentialPanel: FC<CredentialPanelProps> = ({
{t('common.operation.setup')}
</Button>
{
systemConfig.enabled && customConfiged && (
systemConfig.enabled && isCustomConfigured && (
<PrioritySelector
value={priorityUseType}
onSelect={handleChangePriority}
@ -98,7 +98,7 @@ const CredentialPanel: FC<CredentialPanelProps> = ({
)
}
{
systemConfig.enabled && customConfiged && !provider.provider_credential_schema && (
systemConfig.enabled && isCustomConfigured && !provider.provider_credential_schema && (
<div className='ml-1'>
<PrioritySelector
value={priorityUseType}