Fix variable typo (#8084)

This commit is contained in:
Nam Vu
2024-09-08 12:14:11 +07:00
committed by GitHub
parent b1918dae5e
commit 2d7954c7da
215 changed files with 599 additions and 597 deletions

View File

@@ -22,11 +22,11 @@ import { LanguagesSupported } from '@/i18n/language'
import { useProviderContext } from '@/context/provider-context'
import { Plan } from '@/app/components/billing/type'
export type IAppSelecotr = {
export type IAppSelector = {
isMobile: boolean
}
export default function AppSelector({ isMobile }: IAppSelecotr) {
export default function AppSelector({ isMobile }: IAppSelector) {
const itemClassName = `
flex items-center w-full h-9 px-3 text-gray-700 text-[14px]
rounded-lg font-normal hover:bg-gray-50 cursor-pointer

View File

@@ -90,7 +90,7 @@ export default function AccountPage() {
setPassword('')
setConfirmPassword('')
}
const handleSavePassowrd = async () => {
const handleSavePassword = async () => {
if (!valid())
return
try {
@@ -235,7 +235,7 @@ export default function AccountPage() {
<Button
disabled={editing}
variant='primary'
onClick={handleSavePassowrd}
onClick={handleSavePassword}
>
{userProfile.is_password_set ? t('common.operation.reset') : t('common.operation.save')}
</Button>

View File

@@ -15,7 +15,7 @@ import I18n from '@/context/i18n'
import { useAppContext } from '@/context/app-context'
import Avatar from '@/app/components/base/avatar'
import type { InvitationResult } from '@/models/common'
import LogoEmbededChatHeader from '@/app/components/base/logo/logo-embeded-chat-header'
import LogoEmbeddedChatHeader from '@/app/components/base/logo/logo-embedded-chat-header'
import { useProviderContext } from '@/context/provider-context'
import { Plan } from '@/app/components/billing/type'
import UpgradeBtn from '@/app/components/billing/upgrade-btn'
@@ -49,7 +49,7 @@ const MembersPage = () => {
<>
<div className='flex flex-col'>
<div className='flex items-center mb-4 p-3 bg-gray-50 rounded-2xl'>
<LogoEmbededChatHeader className='!w-10 !h-10' />
<LogoEmbeddedChatHeader className='!w-10 !h-10' />
<div className='grow mx-2'>
<div className='text-sm font-medium text-gray-900'>{currentWorkspace?.name}</div>
{enableBilling && (

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}

View File

@@ -17,16 +17,16 @@ const ExploreNav = ({
}: ExploreNavProps) => {
const { t } = useTranslation()
const selectedSegment = useSelectedLayoutSegment()
const actived = selectedSegment === 'explore'
const activated = selectedSegment === 'explore'
return (
<Link href="/explore/apps" className={classNames(
className, 'group',
actived && 'bg-components-main-nav-nav-button-bg-active shadow-md',
actived ? 'text-components-main-nav-nav-button-text-active' : 'text-components-main-nav-nav-button-text hover:bg-components-main-nav-nav-button-bg-hover',
activated && 'bg-components-main-nav-nav-button-bg-active shadow-md',
activated ? 'text-components-main-nav-nav-button-text-active' : 'text-components-main-nav-nav-button-text hover:bg-components-main-nav-nav-button-bg-hover',
)}>
{
actived
activated
? <RiPlanetFill className='mr-2 w-4 h-4' />
: <RiPlanetLine className='mr-2 w-4 h-4' />
}

View File

@@ -34,21 +34,21 @@ const Nav = ({
const setAppDetail = useAppStore(state => state.setAppDetail)
const [hovered, setHovered] = useState(false)
const segment = useSelectedLayoutSegment()
const isActived = Array.isArray(activeSegment) ? activeSegment.includes(segment!) : segment === activeSegment
const isActivated = Array.isArray(activeSegment) ? activeSegment.includes(segment!) : segment === activeSegment
return (
<div className={`
flex items-center h-8 mr-0 sm:mr-3 px-0.5 rounded-xl text-sm shrink-0 font-medium
${isActived && 'bg-components-main-nav-nav-button-bg-active shadow-md font-semibold'}
${!curNav && !isActived && 'hover:bg-components-main-nav-nav-button-bg-hover'}
${isActivated && 'bg-components-main-nav-nav-button-bg-active shadow-md font-semibold'}
${!curNav && !isActivated && 'hover:bg-components-main-nav-nav-button-bg-hover'}
`}>
<Link href={link}>
<div
onClick={() => setAppDetail()}
className={classNames(`
flex items-center h-7 px-2.5 cursor-pointer rounded-[10px]
${isActived ? 'text-components-main-nav-nav-button-text-active' : 'text-components-main-nav-nav-button-text'}
${curNav && isActived && 'hover:bg-components-main-nav-nav-button-bg-active-hover'}
${isActivated ? 'text-components-main-nav-nav-button-text-active' : 'text-components-main-nav-nav-button-text'}
${curNav && isActivated && 'hover:bg-components-main-nav-nav-button-bg-active-hover'}
`)}
onMouseEnter={() => setHovered(true)}
onMouseLeave={() => setHovered(false)}
@@ -57,7 +57,7 @@ const Nav = ({
{
(hovered && curNav)
? <ArrowNarrowLeft className='w-4 h-4' />
: isActived
: isActivated
? activeIcon
: icon
}
@@ -66,7 +66,7 @@ const Nav = ({
</div>
</Link>
{
curNav && isActived && (
curNav && isActivated && (
<>
<div className='font-light text-gray-300 '>/</div>
<NavSelector

View File

@@ -11,7 +11,7 @@ import { useRouter } from 'next/navigation'
import { debounce } from 'lodash-es'
import cn from '@/utils/classnames'
import AppIcon from '@/app/components/base/app-icon'
import { AiText, ChatBot, CuteRobote } from '@/app/components/base/icons/src/vender/solid/communication'
import { AiText, ChatBot, CuteRobot } from '@/app/components/base/icons/src/vender/solid/communication'
import { Route } from '@/app/components/base/icons/src/vender/solid/mapsAndTravel'
import { useAppContext } from '@/context/app-context'
import { useStore as useAppStore } from '@/app/components/app/store'
@@ -94,7 +94,7 @@ const NavSelector = ({ curNav, navs, createText, isApp, onCreate, onLoadmore }:
<ChatBot className='w-2.5 h-2.5 text-[#1570EF]' />
)}
{nav.mode === 'agent-chat' && (
<CuteRobote className='w-2.5 h-2.5 text-indigo-600' />
<CuteRobot className='w-2.5 h-2.5 text-indigo-600' />
)}
{nav.mode === 'chat' && (
<ChatBot className='w-2.5 h-2.5 text-[#1570EF]' />

View File

@@ -17,16 +17,16 @@ const ToolsNav = ({
}: ToolsNavProps) => {
const { t } = useTranslation()
const selectedSegment = useSelectedLayoutSegment()
const actived = selectedSegment === 'tools'
const activated = selectedSegment === 'tools'
return (
<Link href="/tools" className={classNames(
className, 'group',
actived && 'bg-white shadow-md',
actived ? 'text-primary-600' : 'text-gray-500 hover:bg-gray-200',
activated && 'bg-white shadow-md',
activated ? 'text-primary-600' : 'text-gray-500 hover:bg-gray-200',
)}>
{
actived
activated
? <RiHammerFill className='mr-2 w-4 h-4' />
: <RiHammerLine className='mr-2 w-4 h-4' />
}