feat: Make the logic of APP filtering and creation the same (#16079)

Co-authored-by: 刘江波 <jiangbo721@163.com>
This commit is contained in:
jiangbo721 2025-03-23 09:40:15 +08:00 committed by GitHub
parent f6ac98a37d
commit f31e3313b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 3 deletions

View File

@ -50,7 +50,15 @@ class AppListApi(Resource):
parser.add_argument( parser.add_argument(
"mode", "mode",
type=str, type=str,
choices=["chat", "workflow", "agent-chat", "channel", "all"], choices=[
"completion",
"chat",
"advanced-chat",
"workflow",
"agent-chat",
"channel",
"all",
],
default="all", default="all",
location="args", location="args",
required=False, required=False,

View File

@ -36,9 +36,13 @@ class AppService:
filters = [App.tenant_id == tenant_id, App.is_universal == False] filters = [App.tenant_id == tenant_id, App.is_universal == False]
if args["mode"] == "workflow": if args["mode"] == "workflow":
filters.append(App.mode.in_([AppMode.WORKFLOW.value, AppMode.COMPLETION.value])) filters.append(App.mode == AppMode.WORKFLOW.value)
elif args["mode"] == "completion":
filters.append(App.mode == AppMode.COMPLETION.value)
elif args["mode"] == "chat": elif args["mode"] == "chat":
filters.append(App.mode.in_([AppMode.CHAT.value, AppMode.ADVANCED_CHAT.value])) filters.append(App.mode == AppMode.CHAT.value)
elif args["mode"] == "advanced-chat":
filters.append(App.mode == AppMode.ADVANCED_CHAT.value)
elif args["mode"] == "agent-chat": elif args["mode"] == "agent-chat":
filters.append(App.mode == AppMode.AGENT_CHAT.value) filters.append(App.mode == AppMode.AGENT_CHAT.value)
elif args["mode"] == "channel": elif args["mode"] == "channel":

View File

@ -8,6 +8,7 @@ import { useDebounceFn } from 'ahooks'
import { import {
RiApps2Line, RiApps2Line,
RiExchange2Line, RiExchange2Line,
RiFile4Line,
RiMessage3Line, RiMessage3Line,
RiRobot3Line, RiRobot3Line,
} from '@remixicon/react' } from '@remixicon/react'
@ -81,6 +82,8 @@ const Apps = () => {
{ 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: '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: '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]' /> }, { value: 'workflow', text: t('app.types.workflow'), icon: <RiExchange2Line className='mr-1 h-[14px] w-[14px]' /> },
] ]