import type { PluginDetail } from '@/app/components/plugins/types' import * as React from 'react' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import ToolItem from '@/app/components/tools/provider/tool-item' import { useAllToolProviders, useBuiltinTools } from '@/service/use-tools' type Props = Readonly<{ detail: PluginDetail }> const ActionList = ({ detail }: Props) => { const { t } = useTranslation() const providerBriefInfo = detail.declaration?.tool?.identity const providerKey = providerBriefInfo ? `${detail.plugin_id}/${providerBriefInfo.name}` : '' const { data: collectionList = [] } = useAllToolProviders() const provider = useMemo(() => { return collectionList.find((collection) => collection.name === providerKey) }, [collectionList, providerKey]) const { data } = useBuiltinTools(providerKey) if (!providerKey || !data || !provider) return null return (
{t(($) => $['detailPanel.actionNum'], { ns: 'plugin', num: data.length, action: data.length > 1 ? 'actions' : 'action', })}
{data.map((tool) => ( ))}
) } export default ActionList