mirror of https://github.com/langgenius/dify.git
fix: crash when dataset icon_info is undefined in Knowledge Retrieval node (#33907)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
This commit is contained in:
parent
25a83065d2
commit
76a23deba7
|
|
@ -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>
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue