|
@@ -29,6 +29,8 @@ import { useTabSearchParams } from '@/hooks/use-tab-searchparams'
|
|
|
import { useStore as useTagStore } from '@/app/components/base/tag-management/store'
|
|
|
import { useAppContext } from '@/context/app-context'
|
|
|
import { useExternalApiPanel } from '@/context/external-api-panel-context'
|
|
|
+import { SimpleSelect } from '@/app/components/base/select'
|
|
|
+import { fetchTypes } from '@/service/common'
|
|
|
|
|
|
const Container = () => {
|
|
|
const { t } = useTranslation()
|
|
@@ -81,6 +83,20 @@ const Container = () => {
|
|
|
return router.replace('/apps')
|
|
|
}, [currentWorkspace, router])
|
|
|
|
|
|
+ const [type, setType] = useState<any>()
|
|
|
+ const [searchType, setSearchType] = useState('')
|
|
|
+ const { run: handleTypeUpdate } = useDebounceFn(() => {
|
|
|
+ setSearchType(type)
|
|
|
+ }, { wait: 500 })
|
|
|
+ const [optionsType, setOptionsType] = useState<any>([])
|
|
|
+ useEffect(() => {
|
|
|
+ fetchTypes({
|
|
|
+ url: '/workspaces/123123',
|
|
|
+ params: {},
|
|
|
+ }).then((res: any) => {
|
|
|
+ setOptionsType(res.data.map((v: any) => ({ name: v.name, value: v.id })) || [])
|
|
|
+ })
|
|
|
+ }, [])
|
|
|
return (
|
|
|
<div ref={containerRef} className='scroll-container relative flex grow flex-col overflow-y-auto bg-background-body'>
|
|
|
<div className='sticky top-0 z-10 flex flex-wrap justify-between gap-y-2 bg-background-body px-12 pb-2 pt-4 leading-[56px]'>
|
|
@@ -91,6 +107,16 @@ const Container = () => {
|
|
|
/>
|
|
|
{activeTab === 'dataset' && (
|
|
|
<div className='flex items-center justify-center gap-2'>
|
|
|
+ <SimpleSelect
|
|
|
+ className="w-[200px]"
|
|
|
+ defaultValue={type}
|
|
|
+ onSelect={(i) => {
|
|
|
+ setType(i.value)
|
|
|
+ handleTypeUpdate()
|
|
|
+ }}
|
|
|
+ items={optionsType}
|
|
|
+ allowSearch={false}
|
|
|
+ />
|
|
|
{isCurrentWorkspaceOwner && <CheckboxWithLabel
|
|
|
isChecked={includeAll}
|
|
|
onChange={toggleIncludeAll}
|
|
@@ -122,7 +148,7 @@ const Container = () => {
|
|
|
</div>
|
|
|
{activeTab === 'dataset' && (
|
|
|
<>
|
|
|
- <Datasets containerRef={containerRef} tags={tagIDs} keywords={searchKeywords} includeAll={includeAll} />
|
|
|
+ <Datasets containerRef={containerRef} tags={tagIDs} keywords={searchKeywords} includeAll={includeAll} type={searchType} optionsType={optionsType} />
|
|
|
<DatasetFooter />
|
|
|
{showTagManagementModal && (
|
|
|
<TagManagementModal type='knowledge' show={showTagManagementModal} />
|