feat(dify): 把本地控制台的中文与去外链改动入库

这些界面改动和专家服务草稿停在工作区,没有随上一笔主分支提交进入仓库。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-11-23 09:44:09 +08:00
1 parent 9c7c80e194
commit c2cb845a32
211 files changed
+3030 -2794

No files matched your search

@@ -195,7 +195,7 @@ describe('AllStartBlocks', () => {
)
})
it('should link to the trigger marketplace when marketplace is enabled', async () => {
it('does not link to the official trigger marketplace', async () => {
enableMarketplaceForRender = true
render(
@@ -206,30 +206,14 @@ describe('AllStartBlocks', () => {
/>,
)
const footerLink = await screen.findByRole('link', {
name: /plugin\.findMoreInMarketplace/,
})
expect(footerLink.closest('footer')).toBeInTheDocument()
expect(footerLink).toHaveAttribute('href', 'https://marketplace.test/plugins/trigger')
})
it('should expose the panel marketplace destination', async () => {
enableMarketplaceForRender = true
render(
<AllStartBlocks
variant="panel"
searchText=""
onSelect={vi.fn()}
availableBlocksTypes={[BlockEnum.TriggerPlugin]}
/>,
)
const footerLink = await screen.findByRole('link', {
name: /workflow\.nodes\.startPlaceholder\.browseMoreOnMarketplace/,
})
expect(footerLink.closest('footer')).toBeInTheDocument()
expect(footerLink).toHaveAttribute('href', 'https://marketplace.test/plugins/trigger')
expect(
screen.queryByRole('link', { name: /plugin\.findMoreInMarketplace/ }),
).not.toBeInTheDocument()
expect(
screen.queryByRole('link', {
name: /workflow\.nodes\.startPlaceholder\.browseMoreOnMarketplace/,
}),
).not.toBeInTheDocument()
})
it('should render searched marketplace results after built-in and installed trigger options', async () => {
@@ -267,7 +251,9 @@ describe('AllStartBlocks', () => {
const text = container.textContent || ''
expect(text.indexOf('workflow.blocks.start')).toBeLessThan(text.indexOf('Start Provider'))
expect(text.indexOf('Start Provider')).toBeLessThan(text.indexOf('Start Marketplace'))
expect(screen.getAllByRole('link', { name: /plugin\.searchInMarketplace/i })).toHaveLength(1)
expect(
screen.queryByRole('link', { name: /plugin\.searchInMarketplace/i }),
).not.toBeInTheDocument()
})
it('shows installed triggers once and keeps other marketplace results available', async () => {
@@ -313,10 +299,11 @@ describe('AllStartBlocks', () => {
const userInputButton = screen.getByRole('button', { name: 'workflow.blocks.start' })
expect(userInputButton).toHaveAttribute('aria-disabled', 'true')
expect(screen.getByText('common.operation.added')).toBeInTheDocument()
const footer = screen.getByRole('link', { name: /plugin\.findMoreInMarketplace/ })
const disabledRegion = userInputButton.closest('[inert]')
expect(disabledRegion).toHaveAttribute('inert')
expect(disabledRegion).not.toContainElement(footer)
expect(
screen.queryByRole('link', { name: /plugin\.findMoreInMarketplace/ }),
).not.toBeInTheDocument()
fireEvent.click(userInputButton)
fireEvent.click(screen.getByText('Provider One'))
@@ -406,10 +393,9 @@ describe('AllStartBlocks', () => {
'href',
'https://github.com/langgenius/dify-plugins/issues/new?template=plugin_request.yaml',
)
expect(screen.getByRole('link', { name: /plugin\.findMoreInMarketplace/ })).toHaveAttribute(
'href',
'https://marketplace.test/plugins/trigger',
)
expect(
screen.queryByRole('link', { name: /plugin\.findMoreInMarketplace/ }),
).not.toBeInTheDocument()
})
it('should debounce marketplace requests across search and tag changes', async () => {
@@ -1,5 +1,5 @@
import type { ReactElement } from 'react'
import { act, cleanup, screen, waitFor, within } from '@testing-library/react'
import { act, cleanup, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { CollectionType } from '@/app/components/tools/types'
import { renderWithConsoleQuery } from '@/test/console/query-data'
@@ -99,9 +99,7 @@ describe('ToolBrowser', () => {
)
expect(screen.queryByText(/workflowToolEmpty\.step/)).not.toBeInTheDocument()
const footer = screen.getByRole('contentinfo')
expect(within(footer).getAllByRole('link')).toHaveLength(1)
expect(within(footer).getByRole('link', { name: /findMoreInMarketplace/ })).toBeInTheDocument()
expect(screen.queryByRole('link', { name: /findMoreInMarketplace/ })).not.toBeInTheDocument()
})
it('filters providers and updates the heading for each category', async () => {
@@ -350,14 +350,15 @@ describe('ToolPicker', () => {
expect(trigger).toHaveFocus()
})
it('should link the find-more footer to the marketplace tool category', async () => {
it('does not link the tool picker to the official marketplace', async () => {
renderToolPicker({
isShow: true,
selectedTools: [],
})
const footerLink = await screen.findByRole('link', { name: /plugin\.findMoreInMarketplace/i })
expect(footerLink).toHaveAttribute('href', 'https://marketplace.test/plugins/tool')
expect(
screen.queryByRole('link', { name: /plugin\.findMoreInMarketplace/i }),
).not.toBeInTheDocument()
})
it('should render real search and tool lists, then forward tool selections', async () => {
@@ -21,10 +21,6 @@ import PluginList from './marketplace-plugin/list'
import StartBlocks from './start-blocks'
import TriggerPluginList from './trigger-plugin/list'
const popoverMarketplaceFooterClassName =
'system-sm-medium z-10 flex h-8 flex-none items-center border-t border-divider-subtle bg-components-panel-bg-blur px-4 py-1'
const panelMarketplaceFooterClassName =
'system-xs-regular z-10 flex flex-none flex-col items-start gap-2 rounded-lg px-4 pt-2 pb-4'
const DEFAULT_TAGS: string[] = []
const SectionDivider = () => (
@@ -33,11 +29,6 @@ const SectionDivider = () => (
</div>
)
const MarketplaceFooterDivider = () => (
<div className="flex h-2 w-8 items-center" aria-hidden>
<Separator decorative orientation="horizontal" className="my-0 w-8 bg-divider-subtle" />
</div>
)
type AllStartBlocksProps = {
className?: string
@@ -260,46 +251,6 @@ function AllStartBlocks({
</div>
)}
</div>
{marketplace && (
<footer
className={
isPanelVariant ? panelMarketplaceFooterClassName : popoverMarketplaceFooterClassName
}
>
{isPanelVariant && <MarketplaceFooterDivider />}
<Link
className={cn(
'inline-flex items-center rounded-md focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden',
isPanelVariant
? 'gap-1 text-text-tertiary hover:text-text-secondary'
: 'text-text-accent-light-mode-only',
)}
href={marketplace.category(PluginCategoryEnum.trigger)}
target="_blank"
rel="noopener noreferrer"
>
{isPanelVariant ? (
<span className="flex items-center gap-1">
<span
className="i-custom-vender-workflow-marketplace size-3 shrink-0"
aria-hidden
/>
<span>
{t(($) => $['nodes.startPlaceholder.browseMoreOnMarketplace'], {
ns: 'workflow',
})}
</span>
</span>
) : (
<>
<span>{t(($) => $.findMoreInMarketplace, { ns: 'plugin' })}</span>
<span aria-hidden className="ml-0.5 i-ri-arrow-right-up-line size-3" />
</>
)}
</Link>
</footer>
)}
</div>
</div>
)
@@ -24,9 +24,7 @@ import InstallFromMarketplace from '@/app/components/plugins/install-plugin/inst
import Action from '@/app/components/workflow/block-selector/marketplace-plugin/action'
import { useFeaturedToolsCollapsed } from '@/app/components/workflow/block-selector/storage'
import { useGetLanguage } from '@/context/i18n'
import Link from '@/next/link'
import { formatNumber } from '@/utils/format'
import { PluginCategoryEnum } from '../../plugins/types'
import BlockIcon from '../block-icon'
import { BlockEnum } from '../types'
import { BlockSelectorPreviewCardContent } from './preview-card'
@@ -146,14 +144,7 @@ const FeaturedTools = ({
{showEmptyState && (
<p className="py-2 system-xs-regular text-text-tertiary">
<Link
className="text-text-accent"
href={marketplace.category(PluginCategoryEnum.tool)}
target="_blank"
rel="noopener noreferrer"
>
{t(($) => $['tabs.noFeaturedPlugins'], { ns: 'workflow' })}
</Link>
{t(($) => $['tabs.noResult'], { ns: 'workflow' })}
</p>
)}
@@ -279,12 +270,7 @@ function FeaturedToolUninstalledItem({
}, [actionOpen])
const detailsLink = (
<Link
className="flex h-full w-full min-w-0 items-center rounded-lg px-3 group-hover:bg-state-base-hover focus-visible:inset-ring-2 focus-visible:inset-ring-state-accent-solid focus-visible:outline-hidden"
href={marketplace.plugin(plugin)}
target="_blank"
rel="noopener noreferrer"
>
<div className="flex h-full w-full min-w-0 items-center rounded-lg px-3 group-hover:bg-state-base-hover">
<BlockIcon className="shrink-0" type={BlockEnum.Tool} toolIcon={plugin.icon} />
<span className="ml-2 truncate system-sm-medium text-text-secondary">{label}</span>
<span
@@ -298,7 +284,7 @@ function FeaturedToolUninstalledItem({
>
{installCountLabel}
</span>
</Link>
</div>
)
return (
@@ -24,9 +24,7 @@ import InstallFromMarketplace from '@/app/components/plugins/install-plugin/inst
import Action from '@/app/components/workflow/block-selector/marketplace-plugin/action'
import { useFeaturedTriggersCollapsed } from '@/app/components/workflow/block-selector/storage'
import { useGetLanguage } from '@/context/i18n'
import Link from '@/next/link'
import { formatNumber } from '@/utils/format'
import { PluginCategoryEnum } from '../../plugins/types'
import BlockIcon from '../block-icon'
import { BlockEnum } from '../types'
import { BlockSelectorPreviewCardContent } from './preview-card'
@@ -150,14 +148,7 @@ const FeaturedTriggers = ({
{showEmptyState && (
<p className="px-4 py-2 system-xs-regular text-text-tertiary">
<Link
className="text-text-accent"
href={marketplace.category(PluginCategoryEnum.trigger)}
target="_blank"
rel="noopener noreferrer"
>
{t(($) => $['tabs.noFeaturedTriggers'], { ns: 'workflow' })}
</Link>
{t(($) => $['tabs.noResult'], { ns: 'workflow' })}
</p>
)}
@@ -280,12 +271,7 @@ function FeaturedTriggerUninstalledItem({
}, [actionOpen])
const detailsLink = (
<Link
className="flex h-full w-full min-w-0 items-center rounded-lg px-3 group-hover:bg-state-base-hover focus-visible:inset-ring-2 focus-visible:inset-ring-state-accent-solid focus-visible:outline-hidden"
href={marketplace.plugin(plugin)}
target="_blank"
rel="noopener noreferrer"
>
<div className="flex h-full w-full min-w-0 items-center rounded-lg px-3 group-hover:bg-state-base-hover">
<BlockIcon
className="shrink-0"
type={BlockEnum.TriggerPlugin}
@@ -304,7 +290,7 @@ function FeaturedTriggerUninstalledItem({
>
{installCountLabel}
</span>
</Link>
</div>
)
return (
@@ -116,12 +116,11 @@ describe('MarketplaceOperationMenu', () => {
expect(mockDownloadPlugin).toHaveBeenCalledTimes(1)
})
it('should link to the marketplace detail page', () => {
it('does not link plugin actions to the official marketplace', () => {
renderComponent({ open: true })
expect(screen.getByRole('menuitem', { name: 'common.operation.viewDetails' })).toHaveAttribute(
'href',
'https://marketplace.example/plugins/langgenius/test-plugin?theme=light',
)
expect(
screen.queryByRole('menuitem', { name: 'common.operation.viewDetails' }),
).not.toBeInTheDocument()
})
})
@@ -161,13 +161,12 @@ describe('Marketplace plugin selector components', () => {
)
const scrollButton = screen.getByRole('button', { name: 'plugin.fromMarketplace' })
const searchLink = screen.getByRole('link', { name: 'plugin.searchInMarketplace' })
scrollButton.focus()
await user.keyboard('{Enter}')
expect(scrollIntoView).toHaveBeenCalledWith({ behavior: 'smooth', block: 'start' })
expect(searchLink).toHaveAttribute('href', expect.stringContaining('q=filtered'))
expect(screen.queryByRole('link', { name: 'plugin.searchInMarketplace' })).not.toBeInTheDocument()
} finally {
HTMLElement.prototype.scrollIntoView = originalScrollIntoView
}
@@ -190,10 +189,9 @@ describe('Marketplace plugin selector components', () => {
/>,
)
const marketplaceLink = screen.getByRole('link', { name: 'plugin.fromMarketplace' })
expect(marketplaceLink).toHaveAttribute('href', expect.stringContaining('q=filtered'))
expect(marketplaceLink).toHaveAttribute('href', expect.stringContaining('tags=rag'))
expect(screen.queryByRole('button', { name: 'plugin.fromMarketplace' })).not.toBeInTheDocument()
expect(screen.getByText('plugin.fromMarketplace')).toBeInTheDocument()
expect(screen.queryByRole('link', { name: 'plugin.fromMarketplace' })).not.toBeInTheDocument()
expect(screen.queryByRole('link', { name: 'plugin.searchInMarketplace' })).not.toBeInTheDocument()
})
it('should render find-more footer for empty filters and marketplace results for filtered searches', () => {
@@ -213,10 +211,9 @@ describe('Marketplace plugin selector components', () => {
/>,
)
const findMoreLink = screen.getByRole('link', { name: /plugin\.findMoreInMarketplace/i })
expect(new URL(findMoreLink.getAttribute('href')!, window.location.href).pathname).toBe(
'/plugins/tool',
)
expect(
screen.queryByRole('link', { name: /plugin\.findMoreInMarketplace/i }),
).not.toBeInTheDocument()
rerender(
<List
@@ -231,15 +228,9 @@ describe('Marketplace plugin selector components', () => {
expect(screen.getByText('plugin.fromMarketplace')).toBeInTheDocument()
expect(screen.getByText('Filtered Plugin')).toBeInTheDocument()
const marketplaceSearchLinks = screen.getAllByRole('link', {
name: /plugin\.searchInMarketplace/i,
})
expect(marketplaceSearchLinks).toHaveLength(1)
expect(marketplaceSearchLinks[0]).toHaveAttribute('href', expect.stringContaining('q=filtered'))
expect(marketplaceSearchLinks[0]).toHaveAttribute(
'href',
expect.stringContaining('/plugins/tool'),
)
expect(
screen.queryByRole('link', { name: /plugin\.searchInMarketplace/i }),
).not.toBeInTheDocument()
})
it('should hide the marketplace footer when requested and no filters are active', () => {
@@ -1,9 +1,8 @@
'use client'
import type { MarketplaceLinks } from '@/features/marketplace/links'
import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Menu, MenuContent, MenuItem, MenuLinkItem, MenuTrigger } from '@langgenius/dify-ui/menu'
import { Menu, MenuContent, MenuItem, MenuTrigger } from '@langgenius/dify-ui/menu'
import { useMutation } from '@tanstack/react-query'
import { useTheme } from 'next-themes'
import { memo } from 'react'
import { useTranslation } from 'react-i18next'
import { marketplaceQuery } from '@/service/marketplace'
@@ -18,9 +17,8 @@ type Props = Readonly<{
version: string
}>
function OperationMenu({ marketplace, open, onOpenChange, author, name, version }: Props) {
function OperationMenu({ open, onOpenChange, author, name, version }: Props) {
const { t } = useTranslation(['common'])
const { theme } = useTheme()
const downloadMutation = useMutation(
marketplaceQuery.downloadPlugin.mutationOptions({
@@ -64,14 +62,6 @@ function OperationMenu({ marketplace, open, onOpenChange, author, name, version
<MenuItem className="system-md-regular" onClick={handleDownload}>
{t(($) => $['operation.download'], { ns: 'common' })}
</MenuItem>
<MenuLinkItem
className="system-md-regular"
href={marketplace.plugin({ org: author, name }, { theme })}
target="_blank"
rel="noopener noreferrer"
>
{t(($) => $['operation.viewDetails'], { ns: 'common' })}
</MenuLinkItem>
</MenuContent>
</Menu>
)
@@ -5,7 +5,6 @@ import type { MarketplaceLinks } from '@/features/marketplace/links'
import { cn } from '@langgenius/dify-ui/cn'
import { useEffect, useImperativeHandle, useMemo, useRef } from 'react'
import { useTranslation } from 'react-i18next'
import Link from '@/next/link'
import useStickyScroll, { ScrollPosition } from '../use-sticky-scroll'
import Item from './item'
@@ -30,19 +29,13 @@ function List({
searchText,
tags,
list,
category,
toolContentClassName,
disableMaxWidth = false,
hideFindMoreFooter = false,
ref,
}: ListProps) {
const { t } = useTranslation(['plugin'])
const noFilter = !searchText && tags.length === 0
const hasRes = list.length > 0
const urlWithSearchText = marketplace.category(category, {
q: searchText,
tags: tags.join(','),
})
const nextToStickyELemRef = useRef<HTMLDivElement>(null)
const { handleScroll, scrollPosition } = useStickyScroll({
@@ -72,23 +65,7 @@ function List({
nextToStickyELemRef.current?.scrollIntoView({ behavior: 'smooth', block: 'start' })
}
if (noFilter) {
if (hideFindMoreFooter) return null
return (
<footer className="sticky bottom-0 z-10 flex h-8 items-center border-t border-divider-subtle bg-components-panel-bg-blur px-4 py-1 system-sm-medium">
<Link
className="inline-flex items-center rounded-md text-text-accent-light-mode-only focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
href={marketplace.category(category)}
target="_blank"
rel="noopener noreferrer"
>
<span>{t(($) => $.findMoreInMarketplace, { ns: 'plugin' })}</span>
<span aria-hidden className="ml-0.5 i-ri-arrow-right-up-line size-3" />
</Link>
</footer>
)
}
if (noFilter) return null
const maxWidthClassName = toolContentClassName || 'max-w-full'
@@ -111,24 +88,10 @@ function List({
{t(($) => $.fromMarketplace, { ns: 'plugin' })}
</button>
) : (
<Link
href={urlWithSearchText}
target="_blank"
rel="noopener noreferrer"
className="flex min-w-0 flex-1 items-center rounded-md focus-visible:inset-ring-2 focus-visible:inset-ring-state-accent-solid focus-visible:outline-hidden"
>
<span className="flex min-w-0 flex-1 items-center">
{t(($) => $.fromMarketplace, { ns: 'plugin' })}
</Link>
</span>
)}
<Link
href={urlWithSearchText}
target="_blank"
rel="noopener noreferrer"
className="ml-2 flex shrink-0 items-center rounded-md text-text-accent-light-mode-only focus-visible:inset-ring-2 focus-visible:inset-ring-state-accent-solid focus-visible:outline-hidden"
>
<span>{t(($) => $.searchInMarketplace, { ns: 'plugin' })}</span>
<span aria-hidden className="ml-0.5 i-ri-arrow-right-up-line size-3" />
</Link>
</div>
)}
<div className={cn('p-1', !disableMaxWidth && maxWidthClassName)} ref={nextToStickyELemRef}>
@@ -5,13 +5,11 @@ import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import { useQuery } from '@tanstack/react-query'
import { useMemo } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { useTranslation } from 'react-i18next'
import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { getFormattedPlugin } from '@/app/components/plugins/marketplace/utils'
import { selectRAGRecommendedPlugins } from '@/app/components/tools/utils/query-select'
import { useRAGRecommendationsCollapsed } from '@/app/components/workflow/block-selector/storage'
import { useMarketplace } from '@/features/marketplace/client'
import Link from '@/next/link'
import { consoleQuery } from '@/service/console'
import List from './list'
@@ -28,7 +26,6 @@ export function RAGToolRecommendations({
}: RAGToolRecommendationsProps) {
const { t } = useTranslation(['common', 'pipeline'])
const [isCollapsed, setIsCollapsed] = useRAGRecommendationsCollapsed()
const marketplace = useMarketplace()
const {
data: ragRecommendedPlugins,
@@ -79,27 +76,6 @@ export function RAGToolRecommendations({
<LoadingPlaceholder className="h-full" />
</div>
)}
{marketplace &&
!isFetchingRAGRecommendedPlugins &&
recommendedPlugins.length === 0 &&
unInstalledPlugins.length === 0 && (
<p className="px-3 py-1 system-xs-regular text-text-tertiary">
<Trans
i18nKey={($) => $['ragToolSuggestions.noRecommendationPlugins']}
ns="pipeline"
components={{
CustomLink: (
<Link
className="text-text-accent"
target="_blank"
rel="noopener noreferrer"
href={marketplace.page('', { tags: 'rag' })}
/>
),
}}
/>
</p>
)}
{(recommendedPlugins.length > 0 || unInstalledPlugins.length > 0) && (
<>
<List
@@ -26,9 +26,6 @@ import Tools from './tools'
import { ToolType, ViewType } from './types'
import ViewTypeSelect from './view-type-select'
const marketplaceFooterClassName =
'system-sm-medium flex h-8 flex-none items-center border-t border-divider-subtle bg-components-panel-bg-blur px-4 py-1'
function ToolsEmptyState({ title, action }: { title: string; action?: ReactNode }) {
return (
<div className="flex min-h-40 flex-col items-center justify-center gap-3 px-4 py-12 text-center">
@@ -374,19 +371,6 @@ function ToolBrowser({
/>
)}
</div>
{marketplace && !hasFilter && (
<footer className={marketplaceFooterClassName}>
<Link
className="inline-flex items-center rounded-md text-text-accent-light-mode-only focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
href={marketplace.category(PluginCategoryEnum.tool)}
target="_blank"
rel="noopener noreferrer"
>
<span>{t(($) => $.findMoreInMarketplace, { ns: 'plugin' })}</span>
<span aria-hidden className="ml-0.5 i-ri-arrow-right-up-line size-3" />
</Link>
</footer>
)}
</div>
</div>
)
@@ -30,9 +30,11 @@ const Item: FC<Props> = ({
}) => {
return (
<div>
<div className="flex h-5.5 items-center px-3 text-xs font-medium text-text-tertiary">
{groupName}
</div>
{groupName ? (
<div className="flex h-5.5 items-center px-3 text-xs font-medium text-text-tertiary">
{groupName}
</div>
) : null}
<div>
{toolList.map((tool: ToolWithProvider) => (
<Tool
@@ -5,6 +5,7 @@ import type { ToolDefaultValue, ToolValue } from '../../types'
import type { ToolActionPreviewCardHandle } from '../action-item'
import { memo } from 'react'
import { useTranslation } from 'react-i18next'
import { visibleAuthorName } from '@/utils/visible-author'
import Item from './item'
type Props = Readonly<{
@@ -29,7 +30,7 @@ export const ToolListTreeView = memo(
}: Props) => {
const { t } = useTranslation(['workflow'])
const getGroupName = (group: ToolGroup) => {
if (group.kind === 'author') return group.author
if (group.kind === 'author') return visibleAuthorName(group.author)
switch (group.category) {
case 'custom':
@@ -15,6 +15,7 @@ import useTheme from '@/hooks/use-theme'
import { Theme } from '@/types/app'
import { getProviderReference, matchesProviderReference } from '@/utils/provider-reference'
import { basePath } from '@/utils/var'
import { visibleAuthorName } from '@/utils/visible-author'
import { CollectionType } from '../../../tools/types'
import BlockIcon from '../../block-icon'
import McpToolNotSupportTooltip from '../../nodes/_base/components/mcp-tool-not-support-tooltip'
@@ -104,7 +105,7 @@ function Tool({
}
const groupName = useMemo(() => {
if (payload.type === CollectionType.builtIn) return payload.author
if (payload.type === CollectionType.builtIn) return visibleAuthorName(payload.author)
if (payload.type === CollectionType.custom)
return t(($) => $['tabs.customTool'], { ns: 'workflow' })
@@ -18,6 +18,7 @@ import * as React from 'react'
import { useMemo, useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { CollectionType } from '@/app/components/tools/types'
import { visibleAuthorName } from '@/utils/visible-author'
import BlockIcon from '@/app/components/workflow/block-icon'
import { BlockEnum } from '@/app/components/workflow/types'
import { useGetLanguage } from '@/context/i18n'
@@ -74,7 +75,7 @@ const TriggerPluginItem: FC<Props> = ({
const FoldIcon = isFold ? RiArrowRightSLine : RiArrowDownSLine
const groupName = useMemo(() => {
if (payload.type === CollectionType.builtIn) return payload.author
if (payload.type === CollectionType.builtIn) return visibleAuthorName(payload.author)
if (payload.type === CollectionType.custom)
return t(($) => $['tabs.customTool'], { ns: 'workflow' })
@@ -82,7 +83,7 @@ const TriggerPluginItem: FC<Props> = ({
if (payload.type === CollectionType.workflow)
return t(($) => $['tabs.workflowTool'], { ns: 'workflow' })
return payload.author || ''
return visibleAuthorName(payload.author)
}, [payload.author, payload.type, t])
const normalizedIcon = useMemo<TriggerWithProvider['icon']>(() => {
return normalizeProviderIcon(payload.icon) ?? payload.icon