'use client' import type { Collection, Tool } from '../types' import * as React from 'react' import { useState } from 'react' import SettingBuiltInTool from '@/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool' import { useLocale } from '@/context/i18n' import { getLanguage } from '@/i18n-config/language' import { cn } from '@/utils/classnames' type Props = { disabled?: boolean collection: Collection tool: Tool isBuiltIn: boolean isModel: boolean } const ToolItem = ({ disabled, collection, tool, isBuiltIn, isModel, }: Props) => { const locale = useLocale() const language = getLanguage(locale) const [showDetail, setShowDetail] = useState(false) return ( <>
!disabled && setShowDetail(true)} >
{tool.label[language]}
{tool.description[language]}
{showDetail && ( { setShowDetail(false) }} isBuiltIn={isBuiltIn} isModel={isModel} /> )} ) } export default ToolItem