Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix/Add isModel flag to AgentTools component (#2876)

Yeuoly01108e617265
diff --git a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx
index 95858d95406..b92ff949833 100644
--- a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx
+++ b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx
@@ -210,6 +210,7 @@ const AgentTools: FC = () => {
setting={currentTool?.tool_parameters as any}
collection={currentTool?.collection as Collection}
isBuiltIn={currentTool?.collection?.type === CollectionType.builtIn}
+ isModel={currentTool?.collection?.type === CollectionType.model}
onSave={handleToolSettingChange}
onHide={() => setIsShowSettingTool(false)}
/>)
diff --git a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx
index 378054aae6f..9eb2657fcf5 100644
--- a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx
+++ b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx
@@ -58,11 +58,16 @@ const SettingBuiltInTool: FC<Props> = ({
(async () => {
setIsLoading(true)
try {
- const list = isBuiltIn
- ? await fetchBuiltInToolList(collection.name)
- : isModel
- ? await fetchModelToolList(collection.name)
- : await fetchCustomToolList(collection.name)
+ const list = await new Promise<Tool[]>((resolve) => {
+ (async function () {
+ if (isModel)
+ resolve(await fetchModelToolList(collection.name))
+ else if (isBuiltIn)
+ resolve(await fetchBuiltInToolList(collection.name))
+ else
+ resolve(await fetchCustomToolList(collection.name))
+ }())
+ })
setTools(list)
const currTool = list.find(tool => tool.name === toolName)
if (currTool) {