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: crash when dataset icon_info is undefined in Knowledge Retrieval node (#33907)

Copilot76a23deba76c
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/node.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/node.tsx
index 9f5fe1f31c7..3fafdd018e3 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/node.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/node.tsx
@@ -33,21 +33,29 @@ const Node: FC<NodeProps<KnowledgeRetrievalNodeType>> = ({
return (
<div className="mb-1 px-3 py-1">
<div className="space-y-0.5">
- {selectedDatasets.map(({ id, name, icon_info }) => (
- <div key={id} className="flex h-[26px] items-center gap-x-1 rounded-md bg-workflow-block-parma-bg px-1">
- <AppIcon
- size="xs"
- iconType={icon_info.icon_type}
- icon={icon_info.icon}
- background={icon_info.icon_type === 'image' ? undefined : icon_info.icon_background}
- imageUrl={icon_info.icon_type === 'image' ? icon_info.icon_url : undefined}
- className="shrink-0"
- />
- <div className="system-xs-regular w-0 grow truncate text-text-secondary">
- {name}
+ {selectedDatasets.map(({ id, name, icon_info }) => {
+ const iconInfo = icon_info || {
+ icon: '📙',
+ icon_type: 'emoji' as const,
+ icon_background: '#FFF4ED',
+ icon_url: '',
+ }
+ return (
+ <div key={id} className="flex h-[26px] items-center gap-x-1 rounded-md bg-workflow-block-parma-bg px-1">
+ <AppIcon
+ size="xs"
+ iconType={iconInfo.icon_type}
+ icon={iconInfo.icon}
+ background={iconInfo.icon_type === 'image' ? undefined : iconInfo.icon_background}
+ imageUrl={iconInfo.icon_type === 'image' ? iconInfo.icon_url : undefined}
+ className="shrink-0"
+ />
+ <div className="system-xs-regular w-0 grow truncate text-text-secondary">
+ {name}
+ </div>
</div>
- </div>
- ))}
+ )
+ })}
</div>
</div>
)