app list filter

This commit is contained in:
JzoNg
2024-11-14 15:08:58 +08:00
parent 7446244147
commit 7b4d67d72f
7 changed files with 39 additions and 27 deletions

View File

@ -40,7 +40,7 @@ const AppPicker: FC<Props> = ({
const [searchText, setSearchText] = useState('')
const { data: appList } = useAppFullList()
const filteredAppList = useMemo(() => {
return (appList || []).filter(app => app.name.toLowerCase().includes(searchText.toLowerCase()))
return (appList?.data || []).filter(app => app.name.toLowerCase().includes(searchText.toLowerCase())).filter(app => (app.mode !== 'advanced-chat' && app.mode !== 'workflow') || !!app.workflow)
}, [appList, searchText])
const getAppType = (app: App) => {
switch (app.mode) {
@ -81,7 +81,6 @@ const AppPicker: FC<Props> = ({
<Input
showLeftIcon
showClearIcon
// wrapperClassName='w-[200px]'
value={searchText}
onChange={e => setSearchText(e.target.value)}
onClear={() => setSearchText('')}

View File

@ -26,6 +26,7 @@ const AppTrigger = ({
)}>
{appDetail && (
<AppIcon
className='mr-2'
size='xs'
iconType={appDetail.icon_type}
icon={appDetail.icon}

View File

@ -48,7 +48,7 @@ const AppSelector: FC<Props> = ({
onShowChange(true)
}
const { data: currentApp } = useAppDetail(value?.app_id || '')
const { data: currentApp } = useAppDetail(value?.app_id || 'empty')
const [isShowChooseApp, setIsShowChooseApp] = useState(false)
const handleSelectApp = (app: App) => {
const appValue = {
@ -74,7 +74,7 @@ const AppSelector: FC<Props> = ({
>
<AppTrigger
open={isShow}
appDetail={undefined}
appDetail={currentApp}
/>
</PortalToFollowElemTrigger>
<PortalToFollowElemContent className='z-[1000]'>
@ -87,7 +87,7 @@ const AppSelector: FC<Props> = ({
trigger={
<AppTrigger
open={isShowChooseApp}
appDetail={undefined}
appDetail={currentApp}
/>
}
isShow={isShowChooseApp}

View File

@ -73,7 +73,7 @@ const EndpointModal: FC<Props> = ({
isEditMode={true}
showOnVariableMap={{}}
validating={false}
inputClassName='bg-components-input-bg-normal hover:bg-state-base-hover-alt'
inputClassName='bg-components-input-bg-normal hover:bg-components-input-bg-hover'
fieldMoreInfo={item => item.url
? (<a
href={item.url}

View File

@ -67,7 +67,7 @@ const ToolCredentialForm: FC<Props> = ({
isEditMode={true}
showOnVariableMap={{}}
validating={false}
inputClassName='bg-components-input-bg-normal hover:bg-state-base-hover-alt'
inputClassName='bg-components-input-bg-normal hover:bg-components-input-bg-hover'
fieldMoreInfo={item => item.url
? (<a
href={item.url}