Skip to content

Commit a3d18d4

Browse files
authored
fix: tool name in agent (#15344)
1 parent 20cbebe commit a3d18d4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

web/app/components/app/configuration/index.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -625,13 +625,14 @@ const Configuration: FC = () => {
625625
tools: modelConfig.agent_mode?.tools.filter((tool: any) => {
626626
return !tool.dataset
627627
}).map((tool: any) => {
628+
const toolInCollectionList = collectionList.find(c => tool.provider_id === c.id)
628629
return {
629630
...tool,
630631
isDeleted: res.deleted_tools?.some((deletedTool: any) => deletedTool.id === tool.id && deletedTool.tool_name === tool.tool_name),
631-
notAuthor: collectionList.find(c => tool.provider_id === c.id)?.is_team_authorization === false,
632+
notAuthor: toolInCollectionList?.is_team_authorization === false,
632633
...(tool.provider_type === 'builtin' ? {
633-
provider_id: correctToolProvider(tool.provider_name),
634-
provider_name: correctToolProvider(tool.provider_name),
634+
provider_id: correctToolProvider(tool.provider_name, !!toolInCollectionList),
635+
provider_name: correctToolProvider(tool.provider_name, !!toolInCollectionList),
635636
} : {}),
636637
}
637638
}),

web/utils/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,13 @@ export const correctModelProvider = (provider: string) => {
6969
return `langgenius/${provider}/${provider}`
7070
}
7171

72-
export const correctToolProvider = (provider: string) => {
72+
export const correctToolProvider = (provider: string, toolInCollectionList?: boolean) => {
7373
if (!provider)
7474
return ''
7575

76+
if (toolInCollectionList)
77+
return provider
78+
7679
if (provider.includes('/'))
7780
return provider
7881

0 commit comments

Comments
 (0)