feat(dify): 把本地控制台的中文与去外链改动入库
这些界面改动和专家服务草稿停在工作区,没有随上一笔主分支提交进入仓库。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
9c7c80e194
commit
c2cb845a32
211 files changed
+3030
-2794
No files matched your search
+18
-32
@@ -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 () => {
|
||||
|
||||
+2
-4
@@ -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 () => {
|
||||
|
||||
+4
-3
@@ -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 (
|
||||
|
||||
+4
-5
@@ -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()
|
||||
})
|
||||
})
|
||||
+10
-19
@@ -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', () => {
|
||||
|
||||
+2
-12
@@ -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>
|
||||
)
|
||||
|
||||
+3
-40
@@ -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}>
|
||||
|
||||
+1
-25
@@ -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>
|
||||
)
|
||||
|
||||
+5
-3
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+15
-7
@@ -15,6 +15,8 @@ import {
|
||||
} from '@langgenius/dify-ui/popover'
|
||||
import { useRef } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
import { visibleAuthorName } from '@/utils/visible-author'
|
||||
import { useStoreApi } from 'reactflow'
|
||||
import { handleWorkflowMenuKeyDown } from '../shortcuts/handle-workflow-menu-key-down'
|
||||
import { ChangeBlockPopup } from './change-block-popup'
|
||||
@@ -29,6 +31,12 @@ import { useNodeActionsMenuModel } from './use-node-actions-menu-model'
|
||||
export function NodeActionsContextMenuContent(props: NodeActionsMenuProps) {
|
||||
const { t } = useTranslation(['common', 'workflow', 'workflowDebug'])
|
||||
const model = useNodeActionsMenuModel(props)
|
||||
const helpHref = model.helpLinkUri
|
||||
const showNodeHelp = Boolean(helpHref) && !isOfficialDifyUrl(helpHref)
|
||||
const authorName = visibleAuthorName(model.about.author)
|
||||
const authorLabel = authorName
|
||||
? `${t(($) => $['panel.createdBy'], { ns: 'workflow' })} ${authorName}`
|
||||
: undefined
|
||||
const flowStore = useStoreApi()
|
||||
const deletingRef = useRef(false)
|
||||
const hasRunGroup = model.canRun || model.canChangeBlock
|
||||
@@ -92,7 +100,7 @@ export function NodeActionsContextMenuContent(props: NodeActionsMenuProps) {
|
||||
</ContextMenuGroup>
|
||||
)}
|
||||
{hasRunGroup &&
|
||||
(hasEditGroup || hasDeleteGroup || model.workflowAppHref || model.helpLinkUri) && (
|
||||
(hasEditGroup || hasDeleteGroup || model.workflowAppHref || showNodeHelp) && (
|
||||
<ContextMenuSeparator />
|
||||
)}
|
||||
{hasEditGroup && (
|
||||
@@ -115,7 +123,7 @@ export function NodeActionsContextMenuContent(props: NodeActionsMenuProps) {
|
||||
</ContextMenuItem>
|
||||
</ContextMenuGroup>
|
||||
)}
|
||||
{hasEditGroup && (hasDeleteGroup || model.workflowAppHref || model.helpLinkUri) && (
|
||||
{hasEditGroup && (hasDeleteGroup || model.workflowAppHref || showNodeHelp) && (
|
||||
<ContextMenuSeparator />
|
||||
)}
|
||||
{hasDeleteGroup && (
|
||||
@@ -131,7 +139,7 @@ export function NodeActionsContextMenuContent(props: NodeActionsMenuProps) {
|
||||
</ContextMenuItem>
|
||||
</ContextMenuGroup>
|
||||
)}
|
||||
{hasDeleteGroup && (model.workflowAppHref || model.helpLinkUri) && <ContextMenuSeparator />}
|
||||
{hasDeleteGroup && (model.workflowAppHref || showNodeHelp) && <ContextMenuSeparator />}
|
||||
{model.workflowAppHref && (
|
||||
<ContextMenuGroup>
|
||||
<ContextMenuLinkItem
|
||||
@@ -143,10 +151,10 @@ export function NodeActionsContextMenuContent(props: NodeActionsMenuProps) {
|
||||
</ContextMenuLinkItem>
|
||||
</ContextMenuGroup>
|
||||
)}
|
||||
{model.workflowAppHref && model.helpLinkUri && <ContextMenuSeparator />}
|
||||
{model.helpLinkUri && (
|
||||
{model.workflowAppHref && showNodeHelp && <ContextMenuSeparator />}
|
||||
{showNodeHelp && (
|
||||
<ContextMenuGroup>
|
||||
<ContextMenuLinkItem href={model.helpLinkUri} target="_blank" rel="noopener noreferrer">
|
||||
<ContextMenuLinkItem href={helpHref} target="_blank" rel="noopener noreferrer">
|
||||
{t(($) => $['panel.helpLink'], { ns: 'workflow' })}
|
||||
</ContextMenuLinkItem>
|
||||
</ContextMenuGroup>
|
||||
@@ -155,7 +163,7 @@ export function NodeActionsContextMenuContent(props: NodeActionsMenuProps) {
|
||||
<NodeActionsMenuAbout
|
||||
title={t(($) => $['panel.about'], { ns: 'workflow' })}
|
||||
description={model.about.description}
|
||||
author={`${t(($) => $['panel.createdBy'], { ns: 'workflow' })} ${model.about.author}`}
|
||||
author={authorLabel}
|
||||
/>
|
||||
</ContextMenuContent>
|
||||
)
|
||||
|
||||
@@ -22,6 +22,8 @@ import {
|
||||
} from '@langgenius/dify-ui/popover'
|
||||
import { useCallback, useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
import { visibleAuthorName } from '@/utils/visible-author'
|
||||
import { useStoreApi } from 'reactflow'
|
||||
import { handleWorkflowMenuKeyDown } from '../shortcuts/handle-workflow-menu-key-down'
|
||||
import { ChangeBlockPopup } from './change-block-popup'
|
||||
@@ -92,6 +94,8 @@ export function NodeActionsMenu({
|
||||
function NodeActionsMenuContent(props: NodeActionsContentProps) {
|
||||
const { t } = useTranslation(['common', 'workflow', 'workflowDebug'])
|
||||
const model = useNodeActionsMenuModel(props)
|
||||
const helpHref = model.helpLinkUri
|
||||
const showNodeHelp = Boolean(helpHref) && !isOfficialDifyUrl(helpHref)
|
||||
const flowStore = useStoreApi()
|
||||
const deletingRef = useRef(false)
|
||||
const hasRunGroup = model.canRun || model.canChangeBlock
|
||||
@@ -100,6 +104,10 @@ function NodeActionsMenuContent(props: NodeActionsContentProps) {
|
||||
const singleRunActionLabel = model.isSingleRunning
|
||||
? t(($) => $['debug.variableInspect.trigger.stop'], { ns: 'workflowDebug' })
|
||||
: t(($) => $['panel.runThisStep'], { ns: 'workflow' })
|
||||
const authorName = visibleAuthorName(model.about.author)
|
||||
const authorLabel = authorName
|
||||
? `${t(($) => $['panel.createdBy'], { ns: 'workflow' })} ${authorName}`
|
||||
: undefined
|
||||
|
||||
function handleDelete() {
|
||||
deletingRef.current = true
|
||||
@@ -154,7 +162,7 @@ function NodeActionsMenuContent(props: NodeActionsContentProps) {
|
||||
</MenuGroup>
|
||||
)}
|
||||
{hasRunGroup &&
|
||||
(hasEditGroup || hasDeleteGroup || model.workflowAppHref || model.helpLinkUri) && (
|
||||
(hasEditGroup || hasDeleteGroup || model.workflowAppHref || showNodeHelp) && (
|
||||
<MenuSeparator />
|
||||
)}
|
||||
{hasEditGroup && (
|
||||
@@ -177,7 +185,7 @@ function NodeActionsMenuContent(props: NodeActionsContentProps) {
|
||||
</MenuItem>
|
||||
</MenuGroup>
|
||||
)}
|
||||
{hasEditGroup && (hasDeleteGroup || model.workflowAppHref || model.helpLinkUri) && (
|
||||
{hasEditGroup && (hasDeleteGroup || model.workflowAppHref || showNodeHelp) && (
|
||||
<MenuSeparator />
|
||||
)}
|
||||
{hasDeleteGroup && (
|
||||
@@ -193,7 +201,7 @@ function NodeActionsMenuContent(props: NodeActionsContentProps) {
|
||||
</MenuItem>
|
||||
</MenuGroup>
|
||||
)}
|
||||
{hasDeleteGroup && (model.workflowAppHref || model.helpLinkUri) && <MenuSeparator />}
|
||||
{hasDeleteGroup && (model.workflowAppHref || showNodeHelp) && <MenuSeparator />}
|
||||
{model.workflowAppHref && (
|
||||
<MenuGroup>
|
||||
<MenuLinkItem href={model.workflowAppHref} target="_blank" rel="noopener noreferrer">
|
||||
@@ -201,10 +209,10 @@ function NodeActionsMenuContent(props: NodeActionsContentProps) {
|
||||
</MenuLinkItem>
|
||||
</MenuGroup>
|
||||
)}
|
||||
{model.workflowAppHref && model.helpLinkUri && <MenuSeparator />}
|
||||
{model.helpLinkUri && (
|
||||
{model.workflowAppHref && showNodeHelp && <MenuSeparator />}
|
||||
{showNodeHelp && (
|
||||
<MenuGroup>
|
||||
<MenuLinkItem href={model.helpLinkUri} target="_blank" rel="noopener noreferrer">
|
||||
<MenuLinkItem href={helpHref} target="_blank" rel="noopener noreferrer">
|
||||
{t(($) => $['panel.helpLink'], { ns: 'workflow' })}
|
||||
</MenuLinkItem>
|
||||
</MenuGroup>
|
||||
@@ -213,7 +221,7 @@ function NodeActionsMenuContent(props: NodeActionsContentProps) {
|
||||
<NodeActionsMenuAbout
|
||||
title={t(($) => $['panel.about'], { ns: 'workflow' })}
|
||||
description={model.about.description}
|
||||
author={`${t(($) => $['panel.createdBy'], { ns: 'workflow' })} ${model.about.author}`}
|
||||
author={authorLabel}
|
||||
/>
|
||||
</MenuPopup>
|
||||
</MenuPositioner>
|
||||
|
||||
@@ -33,7 +33,7 @@ export function NodeActionsMenuAbout({
|
||||
<div className="px-3 py-2 text-xs text-text-tertiary">
|
||||
<div className="mb-1 flex h-5.5 items-center font-medium">{title.toLocaleUpperCase()}</div>
|
||||
<div className="mb-1 leading-4.5 text-text-secondary">{description}</div>
|
||||
<div className="leading-4.5">{author}</div>
|
||||
{author ? <div className="leading-4.5">{author}</div> : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
+3
-4
@@ -204,10 +204,9 @@ it('keeps marketplace search and its category link alongside the installed catal
|
||||
systemFeatures: { enable_marketplace: true },
|
||||
})
|
||||
await user.click(screen.getByText('workflowAgent.nodes.agent.strategy.selectTip'))
|
||||
const link = screen.getByRole('link', { name: 'plugin.findMoreInMarketplace' })
|
||||
expect(new URL(link.getAttribute('href')!, window.location.href).pathname).toBe(
|
||||
'/plugins/agent-strategy',
|
||||
)
|
||||
expect(
|
||||
screen.queryByRole('link', { name: 'plugin.findMoreInMarketplace' }),
|
||||
).not.toBeInTheDocument()
|
||||
await screen.findByRole('button', { name: 'Agent provider' })
|
||||
await runDebouncedUserInteraction(MARKETPLACE_SEARCH_DEBOUNCE_MS, async (search) => {
|
||||
await search.type(
|
||||
|
||||
+11
-5
@@ -17,6 +17,7 @@ import useGetIcon from '@/app/components/plugins/install-plugin/base/use-get-ico
|
||||
import Empty from '@/app/components/tools/provider/empty'
|
||||
import { useGetLanguage } from '@/context/i18n'
|
||||
import { renderI18nObject } from '@/i18n/metadata'
|
||||
import { visibleAuthorName } from '@/utils/visible-author'
|
||||
import BlockIcon from '../../../block-icon'
|
||||
import { IndexBar } from '../../../block-selector/index-bar'
|
||||
import { BlockSelectorPreviewCardContent } from '../../../block-selector/preview-card'
|
||||
@@ -213,11 +214,15 @@ export function AgentStrategyList({
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
{authorGroups.map(([author, providers]) => (
|
||||
{authorGroups.map(([author, providers]) => {
|
||||
const authorLabel = visibleAuthorName(author)
|
||||
return (
|
||||
<div key={author}>
|
||||
<div className="flex h-5.5 items-center px-3 text-xs font-medium text-text-tertiary">
|
||||
{author}
|
||||
</div>
|
||||
{authorLabel ? (
|
||||
<div className="flex h-5.5 items-center px-3 text-xs font-medium text-text-tertiary">
|
||||
{authorLabel}
|
||||
</div>
|
||||
) : null}
|
||||
{providers.map((provider) => (
|
||||
<StrategyProvider
|
||||
key={provider.declaration.identity.name}
|
||||
@@ -227,7 +232,8 @@ export function AgentStrategyList({
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
<PreviewCard handle={previewCardHandle}>
|
||||
|
||||
+2
-12
@@ -34,7 +34,6 @@ import {
|
||||
} from '@/app/components/header/account-setting/model-provider-page/declarations'
|
||||
import { useDefaultModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
|
||||
import Form from '@/app/components/header/account-setting/model-provider-page/model-modal/Form'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { useRenderI18nObject } from '@/hooks/use-i18n'
|
||||
import Link from '@/next/link'
|
||||
import { useWorkflowStore } from '../../../store'
|
||||
@@ -89,8 +88,7 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
|
||||
nodeId,
|
||||
} = props
|
||||
const { t } = useTranslation(['workflowAgent'])
|
||||
const docLink = useDocLink()
|
||||
const defaultModel = useDefaultModel(ModelTypeEnum.textGeneration)
|
||||
const defaultModel = useDefaultModel(ModelTypeEnum.textGeneration)
|
||||
const renderI18nObject = useRenderI18nObject()
|
||||
const workflowStore = useWorkflowStore()
|
||||
const { setControlPromptEditorRerenderKey } = workflowStore.getState()
|
||||
@@ -280,15 +278,7 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
|
||||
title={t(($) => $['nodes.agent.strategy.configureTip'], { ns: 'workflowAgent' })}
|
||||
description={
|
||||
<div className="text-xs text-text-tertiary">
|
||||
{t(($) => $['nodes.agent.strategy.configureTipDesc'], { ns: 'workflowAgent' })} <br />
|
||||
<Link
|
||||
href={docLink('/use-dify/nodes/agent')}
|
||||
className="text-text-accent-secondary"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{t(($) => $['nodes.agent.learnMore'], { ns: 'workflowAgent' })}
|
||||
</Link>
|
||||
{t(($) => $['nodes.agent.strategy.configureTipDesc'], { ns: 'workflowAgent' })}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
|
||||
+1
-13
@@ -1,12 +1,9 @@
|
||||
import { RiMindMap } from '@remixicon/react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
|
||||
const FailBranchCard = () => {
|
||||
const { t } = useTranslation(['workflow'])
|
||||
const docLink = useDocLink()
|
||||
|
||||
return (
|
||||
return (
|
||||
<div className="px-4 pt-2">
|
||||
<div className="rounded-[10px] bg-workflow-process-bg p-4">
|
||||
<div className="mb-2 flex h-8 w-8 items-center justify-center rounded-[10px] border-[0.5px] border-components-card-border bg-components-card-bg shadow-lg">
|
||||
@@ -17,15 +14,6 @@ const FailBranchCard = () => {
|
||||
</div>
|
||||
<div className="system-xs-regular text-text-tertiary">
|
||||
{t(($) => $['nodes.common.errorHandle.failBranch.customizeTip'], { ns: 'workflow' })}
|
||||
|
||||
<a
|
||||
href={docLink('/use-dify/debug/error-type')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-text-accent"
|
||||
>
|
||||
{t(($) => $['common.learnMore'], { ns: 'workflow' })}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { iconButtonVariants } from '@langgenius/dify-ui/icon-button'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
|
||||
import { memo } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
import { useNodeHelpLink } from '../hooks/use-node-help-link'
|
||||
|
||||
type HelpLinkProps = {
|
||||
@@ -13,7 +14,7 @@ const HelpLink = ({ nodeType }: HelpLinkProps) => {
|
||||
const { t } = useTranslation(['common'])
|
||||
const link = useNodeHelpLink(nodeType)
|
||||
|
||||
if (!link) return null
|
||||
if (!link || isOfficialDifyUrl(link)) return null
|
||||
|
||||
const label = t(($) => $['userProfile.helpCenter'], { ns: 'common' })
|
||||
|
||||
|
||||
-18
@@ -36,7 +36,6 @@ import useWorkspacePluginInstallPermission from '@/app/components/plugins/instal
|
||||
import { pluginManifestToCardPluginProps } from '@/app/components/plugins/install-plugin/utils'
|
||||
import { useMarketplace, useMarketplacePluginVersions } from '@/features/marketplace/client'
|
||||
import useTimestamp from '@/hooks/use-timestamp'
|
||||
import Link from '@/next/link'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
import {
|
||||
normalizeInstalledPluginDetail,
|
||||
@@ -181,7 +180,6 @@ export const SwitchPluginVersion: FC<SwitchPluginVersionProps> = (props) => {
|
||||
}
|
||||
|
||||
function PluginVersionInstallConfirmation({
|
||||
marketplace,
|
||||
selection,
|
||||
onInstalled,
|
||||
}: {
|
||||
@@ -222,22 +220,6 @@ function PluginVersionInstallConfirmation({
|
||||
</div>
|
||||
</DialogBody>
|
||||
<DialogFooter>
|
||||
{marketplace && (
|
||||
<Link
|
||||
className="me-auto flex items-center justify-center gap-1"
|
||||
href={marketplace.plugin({
|
||||
org: selection.plugin.declaration.author,
|
||||
name: selection.plugin.declaration.name,
|
||||
})}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<span className="system-xs-regular text-xs text-text-accent">
|
||||
{t(($) => $['nodes.agent.installPlugin.changelog'], { ns: 'workflowAgent' })}
|
||||
</span>
|
||||
<span className="i-ri-external-link-line size-3 text-text-accent" />
|
||||
</Link>
|
||||
)}
|
||||
{!mutation.isPending && (
|
||||
<DialogClose render={<Button />}>
|
||||
{t(($) => $['nodes.agent.installPlugin.cancel'], { ns: 'workflowAgent' })}
|
||||
|
||||
+2
-13
@@ -12,7 +12,6 @@ import { useCallback, useId } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import PromptEditor from '@/app/components/base/prompt-editor'
|
||||
import { $createCustomTextNode } from '@/app/components/base/prompt-editor/plugins/custom-text/node'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { useWorkflowVariableType } from '../../../hooks/use-workflow-variables'
|
||||
import { BlockEnum } from '../../../types'
|
||||
import useAvailableVarList from '../../_base/hooks/use-available-var-list'
|
||||
@@ -71,8 +70,7 @@ export function AgentTaskField({
|
||||
const taskLabelId = useId()
|
||||
|
||||
const { t } = useTranslation(['workflow', 'workflowAgent'])
|
||||
const docLink = useDocLink()
|
||||
const getVarType = useWorkflowVariableType()
|
||||
const getVarType = useWorkflowVariableType()
|
||||
const { availableVars, availableNodesWithParent } = useAvailableVarList(id)
|
||||
const [isFocus, { setTrue: setFocus, setFalse: setBlur }] = useBoolean(false)
|
||||
|
||||
@@ -105,16 +103,7 @@ export function AgentTaskField({
|
||||
<Infotip>
|
||||
<InfotipTrigger aria-labelledby={taskLabelId} />
|
||||
<InfotipContent aria-labelledby={taskLabelId}>
|
||||
{t(($) => $[`${i18nPrefix}.task.tooltip`], { ns: 'workflowAgent' })}{' '}
|
||||
<a
|
||||
href={docLink('/use-dify/nodes/agent#give-it-a-task')}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="inline-flex items-center gap-0.5 rounded-sm text-text-accent hover:underline focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
|
||||
>
|
||||
{t(($) => $[`${i18nPrefix}.task.learnMore`], { ns: 'workflowAgent' })}
|
||||
<span aria-hidden className="i-ri-external-link-line size-3" />
|
||||
</a>
|
||||
{t(($) => $[`${i18nPrefix}.task.tooltip`], { ns: 'workflowAgent' })}
|
||||
</InfotipContent>
|
||||
</Infotip>
|
||||
</div>
|
||||
|
||||
@@ -6,13 +6,11 @@ import * as React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useLocale } from '#i18n'
|
||||
import Field from '@/app/components/workflow/nodes/_base/components/field'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
import { LanguagesSupported } from '@/i18n/language'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
import OutputVars, { VarItem } from '../_base/components/output-vars'
|
||||
import Split from '../_base/components/split'
|
||||
import VarReferencePicker from '../_base/components/variable/var-reference-picker'
|
||||
import { useNodeHelpLink } from '../_base/hooks/use-node-help-link'
|
||||
import useConfig from './use-config'
|
||||
|
||||
const i18nPrefix = 'nodes.docExtractor'
|
||||
@@ -20,7 +18,6 @@ const i18nPrefix = 'nodes.docExtractor'
|
||||
const Panel: FC<NodePanelProps<DocExtractorNodeType>> = ({ id, data }) => {
|
||||
const { t } = useTranslation(['workflow'])
|
||||
const locale = useLocale()
|
||||
const link = useNodeHelpLink(BlockEnum.DocExtractor)
|
||||
const { data: supportFileTypesResponse } = useQuery(
|
||||
consoleQuery.files.supportType.get.queryOptions(),
|
||||
)
|
||||
@@ -61,9 +58,6 @@ const Panel: FC<NodePanelProps<DocExtractorNodeType>> = ({ id, data }) => {
|
||||
ns: 'workflow',
|
||||
types: supportTypesShowNames,
|
||||
})}
|
||||
<a className="text-text-accent" href={link} target="_blank" rel="noopener noreferrer">
|
||||
{t(($) => $[`${i18nPrefix}.learnMore`], { ns: 'workflow' })}
|
||||
</a>
|
||||
</div>
|
||||
</>
|
||||
</Field>
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ import { memo } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import BlockIcon from '@/app/components/workflow/block-icon'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
|
||||
type HumanInputMigrationBannerProps = {
|
||||
canEdit: boolean
|
||||
@@ -23,7 +24,7 @@ const HumanInputMigrationBanner = ({
|
||||
<div className="min-w-0 flex-1 system-xs-regular text-text-secondary">
|
||||
{t(($) => $['nodes.humanInputMigration.banner.description'], { ns: 'workflow' })}
|
||||
</div>
|
||||
{helpLink && (
|
||||
{helpLink && !isOfficialDifyUrl(helpLink) && (
|
||||
<a
|
||||
href={helpLink}
|
||||
target="_blank"
|
||||
|
||||
+2
-41
@@ -5,14 +5,13 @@ import type { DeliveryMethod } from '../../types'
|
||||
import { cn } from '@langgenius/dify-ui/cn'
|
||||
import { IconButton } from '@langgenius/dify-ui/icon-button'
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover'
|
||||
import { useQuery, useSuspenseQuery } from '@tanstack/react-query'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { memo, useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { v4 as uuid4 } from 'uuid'
|
||||
import Badge from '@/app/components/base/badge'
|
||||
import useWorkflowNodes from '@/app/components/workflow/store/workflow/use-nodes'
|
||||
import { isTriggerWorkflow } from '@/app/components/workflow/utils/workflow-entry'
|
||||
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
import { DeliveryMethodType } from '../../types'
|
||||
|
||||
@@ -26,10 +25,6 @@ type MethodSelectorProps = {
|
||||
|
||||
const MethodSelector: FC<MethodSelectorProps> = ({ data, onAdd, onShowUpgradeTip }) => {
|
||||
const { t } = useTranslation(['workflowHumanInput'])
|
||||
const { data: deploymentEdition } = useSuspenseQuery({
|
||||
...systemFeaturesQueryOptions(),
|
||||
select: ({ deployment_edition }) => deployment_edition,
|
||||
})
|
||||
const { data: humanInputEmailDeliveryEnabled } = useQuery(
|
||||
consoleQuery.features.get.queryOptions({
|
||||
select: (features) => features.human_input_email_delivery_enabled,
|
||||
@@ -278,40 +273,6 @@ const MethodSelector: FC<MethodSelectorProps> = ({ data, onAdd, onShowUpgradeTip
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{deploymentEdition === 'CLOUD' && (
|
||||
<div className="mt-1 rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg backdrop-blur-xs">
|
||||
<div className="flex items-center gap-2 px-4 py-3">
|
||||
<div
|
||||
className={cn(
|
||||
'rounded-sm border border-divider-regular bg-components-icon-bg-midnight-solid p-1',
|
||||
)}
|
||||
>
|
||||
<span
|
||||
aria-hidden
|
||||
className="i-ri-lightbulb-flash-fill size-4 text-text-primary-on-surface"
|
||||
/>
|
||||
</div>
|
||||
<div className="system-sm-regular text-text-secondary">
|
||||
<div>
|
||||
{t(($) => $[`${i18nPrefix}.deliveryMethod.contactTip1`], {
|
||||
ns: 'workflowHumanInput',
|
||||
})}
|
||||
</div>
|
||||
<Trans
|
||||
i18nKey={($) => $[`${i18nPrefix}.deliveryMethod.contactTip2`]}
|
||||
ns="workflowHumanInput"
|
||||
components={{
|
||||
email: (
|
||||
<a href="mailto:support@dify.ai" className="text-text-accent-light-mode-only">
|
||||
support@dify.ai
|
||||
</a>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
)
|
||||
|
||||
+1
-12
@@ -1,7 +1,6 @@
|
||||
import { cn } from '@langgenius/dify-ui/cn'
|
||||
import * as React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import Line from './line'
|
||||
|
||||
type InstructionProps = {
|
||||
@@ -10,9 +9,7 @@ type InstructionProps = {
|
||||
|
||||
const Instruction = ({ className }: InstructionProps) => {
|
||||
const { t } = useTranslation(['workflow'])
|
||||
const docLink = useDocLink()
|
||||
|
||||
return (
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex flex-col gap-y-2 overflow-hidden rounded-[10px] bg-workflow-process-bg p-4',
|
||||
@@ -37,14 +34,6 @@ const Instruction = ({ className }: InstructionProps) => {
|
||||
<p className="text-text-tertiary">
|
||||
{t(($) => $['nodes.knowledgeBase.chunkStructureTip.message'], { ns: 'workflow' })}
|
||||
</p>
|
||||
<a
|
||||
href={docLink('/use-dify/knowledge/create-knowledge/chunking-and-cleaning-text')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-text-accent"
|
||||
>
|
||||
{t(($) => $['nodes.knowledgeBase.chunkStructureTip.learnMore'], { ns: 'workflow' })}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+1
-12
@@ -12,7 +12,6 @@ import { RadioGroup } from '@langgenius/dify-ui/radio-group'
|
||||
import { memo } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Field as WorkflowField } from '@/app/components/workflow/nodes/_base/components/layout'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { useRetrievalSetting } from './hooks'
|
||||
import { SearchMethodOption } from './search-method-option'
|
||||
|
||||
@@ -59,8 +58,7 @@ const RetrievalSetting = ({
|
||||
showMultiModalTip,
|
||||
}: RetrievalSettingProps) => {
|
||||
const { t } = useTranslation(['datasetSettings', 'workflow'])
|
||||
const docLink = useDocLink()
|
||||
const { options, hybridSearchModeOptions } = useRetrievalSetting(indexMethod)
|
||||
const { options, hybridSearchModeOptions } = useRetrievalSetting(indexMethod)
|
||||
|
||||
return (
|
||||
<WorkflowField
|
||||
@@ -68,15 +66,6 @@ const RetrievalSetting = ({
|
||||
title: t(($) => $['form.retrievalSetting.title'], { ns: 'datasetSettings' }),
|
||||
subTitle: (
|
||||
<div className="flex items-center body-xs-regular text-text-tertiary">
|
||||
<a
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href={docLink('/use-dify/knowledge/create-knowledge/setting-indexing-methods')}
|
||||
className="text-text-accent"
|
||||
>
|
||||
{t(($) => $['form.retrievalSetting.learnMore'], { ns: 'datasetSettings' })}
|
||||
</a>
|
||||
|
||||
{t(($) => $['nodes.knowledgeBase.aboutRetrieval'], { ns: 'workflow' })}
|
||||
</div>
|
||||
),
|
||||
|
||||
@@ -10,6 +10,7 @@ import { FormTypeEnum } from '@/app/components/header/account-setting/model-prov
|
||||
import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'
|
||||
import { SchemaDialog } from '@/app/components/plugins/plugin-detail-panel/tool-selector/components/schema-dialog'
|
||||
import FormInputItem from '@/app/components/workflow/nodes/_base/components/form-input-item'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
|
||||
const URL_REGEX = /(https?:\/\/\S+)/g
|
||||
|
||||
@@ -27,6 +28,11 @@ const renderDescriptionWithLinks = (description: string): ReactNode => {
|
||||
|
||||
if (start > currentIndex) parts.push(description.slice(currentIndex, start))
|
||||
|
||||
if (isOfficialDifyUrl(url)) {
|
||||
currentIndex = start + url.length
|
||||
return
|
||||
}
|
||||
|
||||
parts.push(
|
||||
<a
|
||||
key={`${url}-${start}`}
|
||||
|
||||
@@ -28,7 +28,6 @@ import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
|
||||
import { localizeKnowledgeRetrievalV2Error } from '@/app/components/workflow/nodes/knowledge-retrieval-v2/error-message'
|
||||
import StatusContainer from '@/app/components/workflow/run/status-container'
|
||||
import { hasRetryNode } from '@/app/components/workflow/utils'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import BlockIcon from '../block-icon'
|
||||
import { BlockEnum } from '../types'
|
||||
import LargeDataAlert from '../variable-inspect/large-data-alert'
|
||||
@@ -87,8 +86,7 @@ const NodePanel: FC<Props> = ({
|
||||
[hideProcessDetail],
|
||||
)
|
||||
const { t } = useTranslation(['workflow', 'workflowLogic', 'workflowHumanInput', 'runLog'])
|
||||
const docLink = useDocLink()
|
||||
const detailsId = useId()
|
||||
const detailsId = useId()
|
||||
const Header = hideProcessDetail ? 'div' : 'button'
|
||||
const statusLabels: Record<string, string> = {
|
||||
succeeded: t(($) => $['tracing.status.succeeded'], { ns: 'workflow' }),
|
||||
@@ -307,14 +305,6 @@ const NodePanel: FC<Props> = ({
|
||||
{nodeInfo.status === 'exception' && (
|
||||
<StatusContainer status="stopped">
|
||||
{localizedError}
|
||||
<a
|
||||
href={docLink('/use-dify/debug/error-type')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-text-accent"
|
||||
>
|
||||
{t(($) => $['common.learnMore'], { ns: 'workflow' })}
|
||||
</a>
|
||||
</StatusContainer>
|
||||
)}
|
||||
{nodeInfo.status === 'failed' && (
|
||||
|
||||
@@ -7,9 +7,9 @@ import { useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import StatusContainer from '@/app/components/workflow/run/status-container'
|
||||
import { ENABLE_HITL_IM } from '@/config'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { resolveConsoleHumanInputFormURL } from '@/features/human-input/console/links'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
import { basePath } from '@/utils/var'
|
||||
|
||||
type ResultProps = {
|
||||
@@ -34,8 +34,7 @@ const StatusPanel: FC<ResultProps> = ({
|
||||
onOpenTracingTab,
|
||||
}) => {
|
||||
const { t } = useTranslation(['runLog', 'workflow', 'appLog', 'workflowHumanInput', 'share'])
|
||||
const docLink = useDocLink()
|
||||
const { data: pausedDetails } = useQuery(
|
||||
const { data: pausedDetails } = useQuery(
|
||||
consoleQuery.workflow.byWorkflowRunId.pauseDetails.get.queryOptions({
|
||||
input:
|
||||
status === 'paused' && workflowRunId
|
||||
@@ -225,14 +224,6 @@ const StatusPanel: FC<ResultProps> = ({
|
||||
<div className="my-2 h-[0.5px] bg-divider-deep" />
|
||||
<div className="system-xs-medium text-text-warning">
|
||||
{error}
|
||||
<a
|
||||
href={docLink('/use-dify/debug/error-type')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-text-accent"
|
||||
>
|
||||
{t(($) => $['common.learnMore'], { ns: 'workflow' })}
|
||||
</a>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
@@ -259,14 +250,14 @@ const StatusPanel: FC<ResultProps> = ({
|
||||
{t(($) => $['humanInputV2.unavailable'], { ns: 'share' })}
|
||||
</p>
|
||||
)}
|
||||
{pausedInputURLs.length > 0 && (
|
||||
{pausedInputURLs.some((url) => !isOfficialDifyUrl(url)) && (
|
||||
<div className="flex flex-col gap-y-0.5">
|
||||
<div className="system-2xs-medium-uppercase text-text-tertiary">
|
||||
{t(($) => $['nodes.humanInput.log.backstageInputURL'], {
|
||||
ns: 'workflowHumanInput',
|
||||
})}
|
||||
</div>
|
||||
{pausedInputURLs.map((url) => (
|
||||
{pausedInputURLs.filter((url) => !isOfficialDifyUrl(url)).map((url) => (
|
||||
<a
|
||||
key={url}
|
||||
href={url}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import type { FC } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
|
||||
const Empty: FC = () => {
|
||||
const { t } = useTranslation(['workflowDebug'])
|
||||
const docLink = useDocLink()
|
||||
|
||||
return (
|
||||
return (
|
||||
<div className="flex h-full flex-col gap-3 rounded-xl bg-background-section p-8">
|
||||
<div className="flex h-10 w-10 items-center justify-center rounded-[10px] border-[0.5px] border-components-card-border bg-components-card-bg shadow-lg backdrop-blur-xs">
|
||||
<span
|
||||
@@ -21,14 +18,6 @@ const Empty: FC = () => {
|
||||
<div className="system-xs-regular text-text-tertiary">
|
||||
{t(($) => $['debug.variableInspect.emptyTip'], { ns: 'workflowDebug' })}
|
||||
</div>
|
||||
<a
|
||||
className="cursor-pointer system-xs-regular text-text-accent"
|
||||
href={docLink('/use-dify/debug/variable-inspect')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{t(($) => $['debug.variableInspect.emptyLink'], { ns: 'workflowDebug' })}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user