feat: remove automatic type selection in app creation modal

pull/20685/head
nite-knite 12 months ago
parent 20bed90554
commit d18cb45f19

@ -1,9 +1,9 @@
'use client' 'use client'
import { useCallback, useEffect, useRef, useState } from 'react' import { useCallback, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useRouter, useSearchParams } from 'next/navigation' import { useRouter } from 'next/navigation'
import { useContext, useContextSelector } from 'use-context-selector' import { useContext, useContextSelector } from 'use-context-selector'
import { RiArrowRightLine, RiArrowRightSLine, RiCommandLine, RiCornerDownLeftLine, RiExchange2Fill } from '@remixicon/react' import { RiArrowRightLine, RiArrowRightSLine, RiCommandLine, RiCornerDownLeftLine, RiExchange2Fill } from '@remixicon/react'
import Link from 'next/link' import Link from 'next/link'
@ -19,7 +19,6 @@ import AppsContext, { useAppContext } from '@/context/app-context'
import { useProviderContext } from '@/context/provider-context' import { useProviderContext } from '@/context/provider-context'
import { ToastContext } from '@/app/components/base/toast' import { ToastContext } from '@/app/components/base/toast'
import type { AppMode } from '@/types/app' import type { AppMode } from '@/types/app'
import { AppModes } from '@/types/app'
import { createApp } from '@/service/apps' import { createApp } from '@/service/apps'
import Input from '@/app/components/base/input' import Input from '@/app/components/base/input'
import Textarea from '@/app/components/base/textarea' import Textarea from '@/app/components/base/textarea'
@ -56,14 +55,6 @@ function CreateApp({ onClose, onSuccess, onCreateFromTemplate }: CreateAppProps)
const isCreatingRef = useRef(false) const isCreatingRef = useRef(false)
const searchParams = useSearchParams()
useEffect(() => {
const category = searchParams.get('category')
if (category && AppModes.includes(category as AppMode))
setAppMode(category as AppMode)
}, [searchParams])
const onCreate = useCallback(async () => { const onCreate = useCallback(async () => {
if (!appMode) { if (!appMode) {
notify({ type: 'error', message: t('app.newApp.appTypeRequired') }) notify({ type: 'error', message: t('app.newApp.appTypeRequired') })
@ -128,7 +119,7 @@ function CreateApp({ onClose, onSuccess, onCreateFromTemplate }: CreateAppProps)
onClick={() => { onClick={() => {
setAppMode('workflow') setAppMode('workflow')
}} /> }} />
<AppTypeCard <AppTypeCard
active={appMode === 'advanced-chat'} active={appMode === 'advanced-chat'}
title={t('app.types.advanced')} title={t('app.types.advanced')}
description={t('app.newApp.advancedShortDescription')} description={t('app.newApp.advancedShortDescription')}

Loading…
Cancel
Save