mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-07-10 03:41:50 +08:00
fix: tool name in agent (#15344)
This commit is contained in:
parent
20cbebeef1
commit
a3d18d43ed
@ -625,13 +625,14 @@ const Configuration: FC = () => {
|
|||||||
tools: modelConfig.agent_mode?.tools.filter((tool: any) => {
|
tools: modelConfig.agent_mode?.tools.filter((tool: any) => {
|
||||||
return !tool.dataset
|
return !tool.dataset
|
||||||
}).map((tool: any) => {
|
}).map((tool: any) => {
|
||||||
|
const toolInCollectionList = collectionList.find(c => tool.provider_id === c.id)
|
||||||
return {
|
return {
|
||||||
...tool,
|
...tool,
|
||||||
isDeleted: res.deleted_tools?.some((deletedTool: any) => deletedTool.id === tool.id && deletedTool.tool_name === tool.tool_name),
|
isDeleted: res.deleted_tools?.some((deletedTool: any) => deletedTool.id === tool.id && deletedTool.tool_name === tool.tool_name),
|
||||||
notAuthor: collectionList.find(c => tool.provider_id === c.id)?.is_team_authorization === false,
|
notAuthor: toolInCollectionList?.is_team_authorization === false,
|
||||||
...(tool.provider_type === 'builtin' ? {
|
...(tool.provider_type === 'builtin' ? {
|
||||||
provider_id: correctToolProvider(tool.provider_name),
|
provider_id: correctToolProvider(tool.provider_name, !!toolInCollectionList),
|
||||||
provider_name: correctToolProvider(tool.provider_name),
|
provider_name: correctToolProvider(tool.provider_name, !!toolInCollectionList),
|
||||||
} : {}),
|
} : {}),
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
@ -69,10 +69,13 @@ export const correctModelProvider = (provider: string) => {
|
|||||||
return `langgenius/${provider}/${provider}`
|
return `langgenius/${provider}/${provider}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const correctToolProvider = (provider: string) => {
|
export const correctToolProvider = (provider: string, toolInCollectionList?: boolean) => {
|
||||||
if (!provider)
|
if (!provider)
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
if (toolInCollectionList)
|
||||||
|
return provider
|
||||||
|
|
||||||
if (provider.includes('/'))
|
if (provider.includes('/'))
|
||||||
return provider
|
return provider
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user