|
@@ -26,12 +26,12 @@ import { MAX_TOOLS_NUM } from '@/config'
|
|
|
import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback'
|
|
|
import Tooltip from '@/app/components/base/tooltip'
|
|
|
import { DefaultToolIcon } from '@/app/components/base/icons/src/public/other'
|
|
|
-// import AddToolModal from '@/app/components/tools/add-tool-modal'
|
|
|
import ConfigCredential from '@/app/components/tools/setting/build-in/config-credentials'
|
|
|
import { updateBuiltInToolCredential } from '@/service/tools'
|
|
|
import cn from '@/utils/classnames'
|
|
|
import ToolPicker from '@/app/components/workflow/block-selector/tool-picker'
|
|
|
import type { ToolDefaultValue } from '@/app/components/workflow/block-selector/types'
|
|
|
+import { canFindTool } from '@/utils'
|
|
|
|
|
|
type AgentToolWithMoreInfo = AgentTool & { icon: any; collection?: Collection } | null
|
|
|
const AgentTools: FC = () => {
|
|
@@ -43,7 +43,7 @@ const AgentTools: FC = () => {
|
|
|
const [currentTool, setCurrentTool] = useState<AgentToolWithMoreInfo>(null)
|
|
|
const currentCollection = useMemo(() => {
|
|
|
if (!currentTool) return null
|
|
|
- const collection = collectionList.find(collection => collection.id.split('/').pop() === currentTool?.provider_id.split('/').pop() && collection.type === currentTool?.provider_type)
|
|
|
+ const collection = collectionList.find(collection => canFindTool(collection.id, currentTool?.provider_id) && collection.type === currentTool?.provider_type)
|
|
|
return collection
|
|
|
}, [currentTool, collectionList])
|
|
|
const [isShowSettingTool, setIsShowSettingTool] = useState(false)
|
|
@@ -51,7 +51,7 @@ const AgentTools: FC = () => {
|
|
|
const tools = (modelConfig?.agentConfig?.tools as AgentTool[] || []).map((item) => {
|
|
|
const collection = collectionList.find(
|
|
|
collection =>
|
|
|
- collection.id.split('/').pop() === item.provider_id.split('/').pop()
|
|
|
+ canFindTool(collection.id, item.provider_id)
|
|
|
&& collection.type === item.provider_type,
|
|
|
)
|
|
|
const icon = collection?.icon
|