From 4c9dd4112ddb56e6e8e155115e5942ad2a320674 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 26 Jun 2025 10:48:11 +0800 Subject: [PATCH] feat: select box setting --- .../auto-update-setting/tool-picker.tsx | 73 +++++++++++++++++-- 1 file changed, 68 insertions(+), 5 deletions(-) diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx index 9f96e4a7aa..5108bb7b96 100644 --- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx @@ -8,9 +8,12 @@ import { } from '@/app/components/base/portal-to-follow-elem' import { useFetchPluginListOrBundleList } from '@/service/use-plugins' import { PLUGIN_TYPE_SEARCH_MAP } from '../../marketplace/plugin-type-switch' +import SearchBox from '@/app/components/plugins/marketplace/search-box' +import { useTranslation } from 'react-i18next' +import cn from '@/utils/classnames' type Props = { - trigger: React.ReactNode + trigger: React.ReactNode value: string[] onChange: (value: string[]) => void isShow: boolean @@ -18,8 +21,6 @@ type Props = { } -const allPluginTypes = [PLUGIN_TYPE_SEARCH_MAP.all, PLUGIN_TYPE_SEARCH_MAP.model, PLUGIN_TYPE_SEARCH_MAP.tool, PLUGIN_TYPE_SEARCH_MAP.agent, PLUGIN_TYPE_SEARCH_MAP.extension, PLUGIN_TYPE_SEARCH_MAP.bundle] - const ToolPicker: FC = ({ trigger, value, @@ -27,24 +28,55 @@ const ToolPicker: FC = ({ isShow, onShowChange, }) => { + const { t } = useTranslation() const toggleShowPopup = useCallback(() => { onShowChange(!isShow) }, [onShowChange, isShow]) + const tabs = [ + { + key: PLUGIN_TYPE_SEARCH_MAP.all, + name: t('plugin.category.all'), + }, + { + key: PLUGIN_TYPE_SEARCH_MAP.model, + name: t('plugin.category.models'), + }, + { + key: PLUGIN_TYPE_SEARCH_MAP.tool, + name: t('plugin.category.tools'), + }, + { + key: PLUGIN_TYPE_SEARCH_MAP.agent, + name: t('plugin.category.agents'), + }, + { + key: PLUGIN_TYPE_SEARCH_MAP.extension, + name: t('plugin.category.extensions'), + }, + { + key: PLUGIN_TYPE_SEARCH_MAP.bundle, + name: t('plugin.category.bundles'), + }, + ] + const [pluginType, setPluginType] = useState(PLUGIN_TYPE_SEARCH_MAP.all) const [query, setQuery] = useState('') + const [tags, setTags] = useState([]) const { data } = useFetchPluginListOrBundleList({ query, + tags, category: pluginType, }) const isBundle = pluginType === PLUGIN_TYPE_SEARCH_MAP.bundle const list = (isBundle ? data?.data?.bundles : data?.data?.plugins) || [] + console.log(list) return ( = ({ {trigger} -
aafdf
+
+
+ +
+
+
+ { + tabs.map(tab => ( +
setPluginType(tab.key)} + > + {tab.name} +
+ )) + } +
+
+
)