'use client' import React, { useState } from 'react' import { useContext } from 'use-context-selector' import type { Collection, Tool } from '../types' import cn from '@/utils/classnames' import I18n from '@/context/i18n' import { getLanguage } from '@/i18n/language' import SettingBuiltInTool from '@/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool' type Props = { disabled?: boolean collection: Collection tool: Tool isBuiltIn: boolean isModel: boolean } const ToolItem = ({ disabled, collection, tool, isBuiltIn, isModel, }: Props) => { const { locale } = useContext(I18n) 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