瀏覽代碼

feat: reorder app types (#20685)

tags/1.4.2
Nite Knite 5 月之前
父節點
當前提交
7094680e23
沒有連結到貢獻者的電子郵件帳戶。

+ 2
- 2
web/app/(commonLayout)/apps/Apps.tsx 查看文件

const anchorRef = useRef<HTMLDivElement>(null) const anchorRef = useRef<HTMLDivElement>(null)
const options = [ const options = [
{ value: 'all', text: t('app.types.all'), icon: <RiApps2Line className='mr-1 h-[14px] w-[14px]' /> }, { value: 'all', text: t('app.types.all'), icon: <RiApps2Line className='mr-1 h-[14px] w-[14px]' /> },
{ value: 'workflow', text: t('app.types.workflow'), icon: <RiExchange2Line className='mr-1 h-[14px] w-[14px]' /> },
{ value: 'advanced-chat', text: t('app.types.advanced'), icon: <RiMessage3Line className='mr-1 h-[14px] w-[14px]' /> },
{ value: 'chat', text: t('app.types.chatbot'), icon: <RiMessage3Line className='mr-1 h-[14px] w-[14px]' /> }, { value: 'chat', text: t('app.types.chatbot'), icon: <RiMessage3Line className='mr-1 h-[14px] w-[14px]' /> },
{ value: 'agent-chat', text: t('app.types.agent'), icon: <RiRobot3Line className='mr-1 h-[14px] w-[14px]' /> }, { value: 'agent-chat', text: t('app.types.agent'), icon: <RiRobot3Line className='mr-1 h-[14px] w-[14px]' /> },
{ value: 'completion', text: t('app.types.completion'), icon: <RiFile4Line className='mr-1 h-[14px] w-[14px]' /> }, { value: 'completion', text: t('app.types.completion'), icon: <RiFile4Line className='mr-1 h-[14px] w-[14px]' /> },
{ value: 'advanced-chat', text: t('app.types.advanced'), icon: <RiMessage3Line className='mr-1 h-[14px] w-[14px]' /> },
{ value: 'workflow', text: t('app.types.workflow'), icon: <RiExchange2Line className='mr-1 h-[14px] w-[14px]' /> },
] ]


useEffect(() => { useEffect(() => {

+ 3
- 12
web/app/components/app/create-app-modal/index.tsx 查看文件

'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'
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'


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') })
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')}

+ 1
- 1
web/app/components/app/type-selector/index.tsx 查看文件

onChange: (value: AppSelectorProps['value']) => void onChange: (value: AppSelectorProps['value']) => void
} }


const allTypes: AppMode[] = ['chat', 'agent-chat', 'completion', 'advanced-chat', 'workflow']
const allTypes: AppMode[] = ['workflow', 'advanced-chat', 'chat', 'agent-chat', 'completion']


const AppTypeSelector = ({ value, onChange }: AppSelectorProps) => { const AppTypeSelector = ({ value, onChange }: AppSelectorProps) => {
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)

Loading…
取消
儲存