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

@@ -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>
)
}