瀏覽代碼

fix: tool name in agent (#15344)

tags/1.0.1
zxhlyh 7 月之前
父節點
當前提交
a3d18d43ed
沒有連結到貢獻者的電子郵件帳戶。
共有 2 個檔案被更改,包括 8 行新增4 行删除
  1. 4
    3
      web/app/components/app/configuration/index.tsx
  2. 4
    1
      web/utils/index.ts

+ 4
- 3
web/app/components/app/configuration/index.tsx 查看文件

@@ -625,13 +625,14 @@ const Configuration: FC = () => {
tools: modelConfig.agent_mode?.tools.filter((tool: any) => {
return !tool.dataset
}).map((tool: any) => {
const toolInCollectionList = collectionList.find(c => tool.provider_id === c.id)
return {
...tool,
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' ? {
provider_id: correctToolProvider(tool.provider_name),
provider_name: correctToolProvider(tool.provider_name),
provider_id: correctToolProvider(tool.provider_name, !!toolInCollectionList),
provider_name: correctToolProvider(tool.provider_name, !!toolInCollectionList),
} : {}),
}
}),

+ 4
- 1
web/utils/index.ts 查看文件

@@ -69,10 +69,13 @@ export const correctModelProvider = (provider: string) => {
return `langgenius/${provider}/${provider}`
}

export const correctToolProvider = (provider: string) => {
export const correctToolProvider = (provider: string, toolInCollectionList?: boolean) => {
if (!provider)
return ''

if (toolInCollectionList)
return provider

if (provider.includes('/'))
return provider


Loading…
取消
儲存