'use client' import type { AgentAppPublishedReferenceResponse, AgentIconType, } from '@dify/contracts/api/console/agent/types.gen' import { DropdownMenu, DropdownMenuContent, DropdownMenuLinkItem, DropdownMenuTrigger, } from '@langgenius/dify-ui/dropdown-menu' import { useTranslation } from 'react-i18next' import AppIcon from '@/app/components/base/app-icon' import Link from '@/next/link' const getWorkflowReferenceHref = (reference: AgentAppPublishedReferenceResponse) => `/app/${reference.app_id}/workflow` const getWorkflowReferenceIconType = ( reference: AgentAppPublishedReferenceResponse, ): AgentIconType | undefined => { if (reference.app_icon_type === 'image' || reference.app_icon_type === 'link') return 'image' if (reference.app_icon_type === 'emoji') return 'emoji' return undefined } const getWorkflowReferenceImageUrl = (reference: AgentAppPublishedReferenceResponse) => { if (reference.app_icon_type === 'image' || reference.app_icon_type === 'link') return reference.app_icon return undefined } export function AgentWorkflowReferencesDropdown({ agentName, publishedReferences, referenceCount, }: { agentName: string publishedReferences: AgentAppPublishedReferenceResponse[] referenceCount: number }) { const { t } = useTranslation('agentV2') return ( $['roster.references.trigger'], { name: agentName, count: referenceCount, })} className="relative flex h-4 shrink-0 cursor-pointer items-center gap-1 rounded-md outline-hidden before:pointer-events-none before:absolute before:-inset-x-1 before:-inset-y-0.5 before:rounded-md before:content-[''] hover:before:bg-state-base-hover focus-visible:before:ring-2 focus-visible:before:ring-state-accent-solid data-popup-open:before:bg-state-base-hover" > {referenceCount}
{t(($) => $['roster.references.label'], { name: agentName })}
{publishedReferences.map((reference) => ( } className="mx-0 h-8 gap-2 px-2 py-1 pr-2.5 system-md-regular text-text-secondary" > {reference.app_name} ))}
) }