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

@@ -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(
@@ -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}>
@@ -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,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' })}
&nbsp;
<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' })
@@ -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' })}
@@ -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>
@@ -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"
@@ -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,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>
@@ -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>
&nbsp;
{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}`}