mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-16 17:45:54 +08:00
fix: agent tools setting (#14097)
This commit is contained in:
parent
79d4db8541
commit
09fc4bba61
@ -26,12 +26,12 @@ import { MAX_TOOLS_NUM } from '@/config'
|
|||||||
import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback'
|
import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback'
|
||||||
import Tooltip from '@/app/components/base/tooltip'
|
import Tooltip from '@/app/components/base/tooltip'
|
||||||
import { DefaultToolIcon } from '@/app/components/base/icons/src/public/other'
|
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 ConfigCredential from '@/app/components/tools/setting/build-in/config-credentials'
|
||||||
import { updateBuiltInToolCredential } from '@/service/tools'
|
import { updateBuiltInToolCredential } from '@/service/tools'
|
||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
import ToolPicker from '@/app/components/workflow/block-selector/tool-picker'
|
import ToolPicker from '@/app/components/workflow/block-selector/tool-picker'
|
||||||
import type { ToolDefaultValue } from '@/app/components/workflow/block-selector/types'
|
import type { ToolDefaultValue } from '@/app/components/workflow/block-selector/types'
|
||||||
|
import { canFindTool } from '@/utils'
|
||||||
|
|
||||||
type AgentToolWithMoreInfo = AgentTool & { icon: any; collection?: Collection } | null
|
type AgentToolWithMoreInfo = AgentTool & { icon: any; collection?: Collection } | null
|
||||||
const AgentTools: FC = () => {
|
const AgentTools: FC = () => {
|
||||||
@ -43,7 +43,7 @@ const AgentTools: FC = () => {
|
|||||||
const [currentTool, setCurrentTool] = useState<AgentToolWithMoreInfo>(null)
|
const [currentTool, setCurrentTool] = useState<AgentToolWithMoreInfo>(null)
|
||||||
const currentCollection = useMemo(() => {
|
const currentCollection = useMemo(() => {
|
||||||
if (!currentTool) return null
|
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
|
return collection
|
||||||
}, [currentTool, collectionList])
|
}, [currentTool, collectionList])
|
||||||
const [isShowSettingTool, setIsShowSettingTool] = useState(false)
|
const [isShowSettingTool, setIsShowSettingTool] = useState(false)
|
||||||
@ -51,7 +51,7 @@ const AgentTools: FC = () => {
|
|||||||
const tools = (modelConfig?.agentConfig?.tools as AgentTool[] || []).map((item) => {
|
const tools = (modelConfig?.agentConfig?.tools as AgentTool[] || []).map((item) => {
|
||||||
const collection = collectionList.find(
|
const collection = collectionList.find(
|
||||||
collection =>
|
collection =>
|
||||||
collection.id.split('/').pop() === item.provider_id.split('/').pop()
|
canFindTool(collection.id, item.provider_id)
|
||||||
&& collection.type === item.provider_type,
|
&& collection.type === item.provider_type,
|
||||||
)
|
)
|
||||||
const icon = collection?.icon
|
const icon = collection?.icon
|
||||||
|
Loading…
x
Reference in New Issue
Block a user