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

@@ -113,11 +113,9 @@ it('opens the caller panel and exposes a marketplace link with the current filte
})
await user.click(screen.getByRole('button', { name: 'plugin.marketplace.moreFrom' }))
expect(screen.getByRole('region', { name: 'Marketplace panel' })).toBeInTheDocument()
const link = screen.getByRole('link', { name: 'plugin.marketplace.difyMarketplace' })
const url = new URL(link.getAttribute('href')!, window.location.origin)
expect(url.searchParams.get('q')).toBe('vector')
expect(url.searchParams.get('tags')).toBe('tag-a,tag-b')
expect(url.searchParams.get('language')).toBe('en-US')
expect(
screen.queryByRole('link', { name: 'plugin.marketplace.difyMarketplace' }),
).not.toBeInTheDocument()
})
it('opens the integrations marketplace from the real collection more button', async () => {
const user = userEvent.setup()
@@ -4,9 +4,7 @@ import type { useToolMarketplace } from './hooks'
import type { MarketplaceLinks } from '@/features/marketplace/links'
import { cn } from '@langgenius/dify-ui/cn'
import { IconButton } from '@langgenius/dify-ui/icon-button'
import { useTheme } from 'next-themes'
import { useTranslation } from 'react-i18next'
import { useLocale } from '#i18n'
import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import List from '@/app/components/plugins/marketplace/list'
import { usePluginSettingsAccess } from '@/app/components/plugins/plugin-page/use-reference-setting'
@@ -23,17 +21,12 @@ type MarketplaceProps = {
contentInset?: ToolsContentInset
}
const Marketplace = ({
marketplace,
searchPluginText,
filterPluginTags,
isMarketplaceArrowVisible,
showMarketplacePanel,
marketplaceContext,
contentInset = 'default',
}: MarketplaceProps) => {
const locale = useLocale()
const { t } = useTranslation(['common', 'plugin'])
const { theme } = useTheme()
const router = useRouter()
const { canInstallPlugin } = usePluginSettingsAccess()
const { isLoading, marketplaceCollections, marketplaceCollectionPluginsMap, plugins, page } =
@@ -98,23 +91,6 @@ const Marketplace = ({
<span className="relative ms-1 me-1 body-md-medium text-text-secondary after:absolute after:inset-s-0 after:bottom-[1.5px] after:h-2 after:w-full after:bg-text-text-selected after:content-['']">
{t(($) => $['category.bundles'], { ns: 'plugin' })}
</span>
{t(($) => $['operation.in'], { ns: 'common' })}
<a
href={marketplace.page('', {
language: locale,
q: searchPluginText,
tags: filterPluginTags.join(','),
theme,
})}
className="ms-1 flex items-center system-sm-medium text-text-accent"
target="_blank"
>
{t(($) => $['marketplace.difyMarketplace'], { ns: 'plugin' })}
<span
aria-hidden="true"
className="i-ri-arrow-right-up-line size-4 rtl:-scale-x-100"
/>
</a>
</div>
</div>
</div>
@@ -18,10 +18,7 @@ describe('Empty', () => {
render(<Empty type={ToolType.Workflow} />)
expect(screen.getByRole('link', { name: /goToStudio/i })).toHaveAttribute('href', '/apps')
expect(screen.getByRole('link', { name: /learnMore/i })).toHaveAttribute(
'href',
'https://docs.dify.ai/en/self-host/use-dify/workspace/tools#workflow',
)
expect(screen.queryByRole('link', { name: /learnMore/i })).not.toBeInTheDocument()
})
it('does not offer installation navigation in an agent empty state', () => {
@@ -1,6 +1,7 @@
'use client'
import { cn } from '@langgenius/dify-ui/cn'
import { RiAddLine, RiArrowRightUpLine } from '@remixicon/react'
import { isOfficialDifyUrl } from '@/utils/official-link'
type CreateEntryCardProps = {
className?: string
@@ -47,20 +48,22 @@ const CreateEntryCard = ({
</div>
</div>
</button>
<a
href={linkUrl}
target="_blank"
rel="noopener noreferrer"
title={linkText}
className="flex h-8 items-center gap-0.5 border-t border-divider-subtle px-3 py-2 text-components-button-secondary-text outline-hidden hover:bg-components-panel-on-panel-item-bg-hover hover:text-text-accent focus-visible:ring-1 focus-visible:ring-components-input-border-hover"
>
<div className="min-w-0 flex-1 px-0.5">
<div className="truncate system-sm-medium" title={linkText}>
{linkText}
{linkUrl && !isOfficialDifyUrl(linkUrl) ? (
<a
href={linkUrl}
target="_blank"
rel="noopener noreferrer"
title={linkText}
className="flex h-8 items-center gap-0.5 border-t border-divider-subtle px-3 py-2 text-components-button-secondary-text outline-hidden hover:bg-components-panel-on-panel-item-bg-hover hover:text-text-accent focus-visible:ring-1 focus-visible:ring-components-input-border-hover"
>
<div className="min-w-0 flex-1 px-0.5">
<div className="truncate system-sm-medium" title={linkText}>
{linkText}
</div>
</div>
</div>
<RiArrowRightUpLine className="size-4 shrink-0 rtl:-scale-x-100" />
</a>
<RiArrowRightUpLine className="size-4 shrink-0 rtl:-scale-x-100" />
</a>
) : null}
</div>
)
}
@@ -63,6 +63,7 @@ import {
updateCustomCollection,
} from '@/service/tools'
import { basePath } from '@/utils/var'
import { visibleAuthorName } from '@/utils/visible-author'
import { AuthHeaderPrefix, AuthType, CollectionType } from '../types'
import ToolItem from './tool-item'
@@ -287,13 +288,13 @@ const ProviderDetail = ({ collection, onHide, onRefreshData }: Props) => {
{collection.type === CollectionType.workflow ||
collection.type === CollectionType.custom ? (
<div className="truncate system-xs-regular text-text-tertiary">
{collection.author &&
`${t(($) => $.author, { ns: 'tools' })} ${collection.author}`}
{visibleAuthorName(collection.author) &&
`${t(($) => $.author, { ns: 'tools' })} ${visibleAuthorName(collection.author)}`}
</div>
) : (
<OrgInfo
packageNameClassName="w-auto"
orgName={collection.author}
orgName={visibleAuthorName(collection.author)}
packageName={collection.name}
/>
)}
@@ -3,7 +3,6 @@ import { cn } from '@langgenius/dify-ui/cn'
import { RiArrowRightLine, RiArrowRightUpLine } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import { buildIntegrationPath } from '@/app/components/integrations/routes'
import { useDocLink } from '@/context/i18n'
import useTheme from '@/hooks/use-theme'
import Link from '@/next/link'
import { ToolType } from '../../workflow/block-selector/types'
@@ -31,8 +30,7 @@ const getLink = (type?: ToolType) => {
}
const Empty = ({ type, isAgent }: Props) => {
const { t } = useTranslation(['tools'])
const docLink = useDocLink()
const { theme } = useTheme()
const { theme } = useTheme()
const hasLink = type === ToolType.Custom || type === ToolType.MCP
const renderType = isAgent ? ('agent' as const) : type
@@ -94,14 +92,6 @@ const Empty = ({ type, isAgent }: Props) => {
</span>
</Link>
</div>
<Link
href={docLink('/use-dify/workspace/tools#workflow')}
target="_blank"
rel="noreferrer"
className="rounded-[5px] border border-divider-deep bg-components-badge-bg-dimm px-1.25 py-0.75 system-2xs-medium-uppercase text-text-tertiary hover:text-text-accent"
>
{t(($) => $['workflowToolEmpty.learnMore'], { ns: 'tools' })}
</Link>
</div>
)
}
@@ -1,5 +1,6 @@
'use client'
import type { FC } from 'react'
import { isOfficialDifyUrl } from '@/utils/official-link'
import type { Collection } from '../../types'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
@@ -134,7 +135,7 @@ const ConfigCredential: FC<Props> = ({
validating={false}
inputClassName="bg-components-input-bg-normal!"
fieldMoreInfo={(item) =>
item.url ? (
item.url && !isOfficialDifyUrl(item.url) ? (
<a
href={item.url}
target="_blank"