mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
feat: enhance plugin filtering with tags support
This commit is contained in:
parent
4cf9ff6132
commit
cce39b85e9
|
@ -21,7 +21,6 @@ import Title from '../card/base/title'
|
|||
import Action from './action'
|
||||
import cn from '@/utils/classnames'
|
||||
import I18n from '@/context/i18n'
|
||||
|
||||
import { API_PREFIX, MARKETPLACE_URL_PREFIX } from '@/config'
|
||||
|
||||
type Props = {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { useDebounceFn } from 'ahooks'
|
|||
import Empty from './empty'
|
||||
|
||||
const PluginsPanel = () => {
|
||||
const [filters, setFilters] = usePluginPageContext(v => [v.filters, v.setFilters])
|
||||
const [filters, setFilters] = usePluginPageContext(v => [v.filters, v.setFilters]) as [FilterState, (filter: FilterState) => void]
|
||||
const pluginList = usePluginPageContext(v => v.installedPluginList) as PluginDetail[]
|
||||
const mutateInstalledPluginList = usePluginPageContext(v => v.mutateInstalledPluginList)
|
||||
|
||||
|
@ -19,11 +19,11 @@ const PluginsPanel = () => {
|
|||
}, { wait: 500 })
|
||||
|
||||
const filteredList = useMemo(() => {
|
||||
// todo: filter by tags
|
||||
const { categories, searchQuery } = filters
|
||||
const { categories, searchQuery, tags } = filters
|
||||
const filteredList = pluginList.filter((plugin) => {
|
||||
return (
|
||||
(categories.length === 0 || categories.includes(plugin.declaration.category))
|
||||
&& (tags.length === 0 || tags.some(tag => plugin.declaration.tags.includes(tag)))
|
||||
&& (searchQuery === '' || plugin.plugin_id.toLowerCase().includes(searchQuery.toLowerCase()))
|
||||
)
|
||||
})
|
||||
|
|
|
@ -69,6 +69,7 @@ export type PluginDeclaration = {
|
|||
endpoint: PluginEndpointDeclaration
|
||||
tool: PluginToolDeclaration
|
||||
model: any // TODO
|
||||
tags: string[]
|
||||
}
|
||||
|
||||
export type PluginManifestInMarket = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user